Accessor Keywords in X++ Programming Language - D365

Rumman Ansari   Software Engineer     604 Share
☰ Table of Contents

Table of Content:


Accessor keywords can be used to control whether the methods in other classes can call the methods in your class. Class inheritance is also affected by the following accessor keywords.

  • public - Methods declared as public can be called from anywhere that the class is accessible. A public method can be overridden by a subclass, unless that method is declared as final.

  • protected - Methods declared as protected can only be called from methods in the same class or methods in a subclass of that class. A protected method can still be overridden in a subclass.

  • private - Methods declared as private can only be called from methods within the same class. Unlike public and protected methods, private methods can't be overridden in a subclass.