Previous: 2.2.13.5. OOP Scopes To the Table of Contents Next: 2.2.13.7. Virtual Methods
2.2.13.5. OOP Scopes Table of Contents 2.2.13.7. Virtual Methods

- 2.2.13.6. -
Table of Contents
2. TMT Pascal Language Description
2.2. Pascal Language Structure
2.2.13. OOP Extensions
2.2.13.6. Public and Private declarations


2.2.13.6. Public and Private declarations


Public and private are standard directives in the Object Pascal language. Treat them as if they were reserved words. For readability, it is best to organize an object declaration by visibility, placing all the private members together, followed by all the protected members, and so on. This way each visibility reserved word appears at most once and marks the beginning of a new section of the declaration. So a typical object declaration should look like this:
type
  TObject = object
    private
      { Private declarations}
    public
      { Public declarations }
    end;
The scope of component identifiers declared in private component sections are restricted to the module that contains the object type declaration. Keep in mind that: Use the public part to Declarations in the private part are restricted in their access. If you declare fields or methods to be private, they are unknown and inaccessible outside the unit the object is defined in.

Use the private part to


Previous: 2.2.13.5. OOP Scopes To the Table of Contents Next: 2.2.13.7. Virtual Methods
2.2.13.5. OOP Scopes Table of Contents 2.2.13.7. Virtual Methods

- 2.2.13.6. -