MCQ Single Best Answer Easy

QYou create a new class by using a method. You need to protect the method from being extended by using Chain of Command (CoC). Which attribute or modifiers should you use to protect the method?

ID: #24587 Explore extensions and the extension framework in finance and operations apps 17 views
Question Info
#24587Q ID
EasyDifficulty
Explore extensions and the extension framework in finance and operations appsTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A Use [Hookable(false)] as a method attribute.
  • B Use [Wrappable(false)] as a method attribute.
  • C Use [Replaceable(true)] as a method attribute.
  • D Use a protected modifier.
Correct Answer: Option B

Explanation

❌Incorrect. You can use ´[Hookable(false)] to block pre-events and post-events, but it doesn’t block extensions that are made by CoC. To prevent extensions that are made by CoC, use the ´[Wrappable(false)] attribute or the private modifier for the method.

✔️ Correct. ´[Wrappable(false)] generates a compiler error if CoC is your method. In this case, the project isn’t built because a compiler error exists.

✔️ Incorrect. ´[Replaceable(true)] allows you to overwrite the existing method and doesn’t generate a compiler error during build.

No Previous No Next

Share This Question

Challenge a friend or share with your study group.