The access modifiers in X++ are now much closer to C#'s access modifiers, and behave just the same.

Who can access foo() when it is…?

Please notice

  • protected internal is the union of protected and internal. I.e. a protected internal method can still be referenced by subclasses outside the defining model.
  • The extensibility attributes (Hookable, Wrappable, Replaceable) are defaulted based on the access modifier. See the relationships here: Attributes that make methods extensible.
  • InternalUseOnlyAttribute is different from Internal.
    • InternalUseOnly is an attribute telling the compiler to warn for external invocation references. As such it can be used to signal that the method will be made internal in the future. However, adding the attribute can break consumers as COC wrappers of internalUseOnly methods will get a compiler error.
    • Internal is an access modifier, controlling the IL generated by the compiler.