next up previous contents index
Next: Class instantiation Up: Classes Previous: Classes

Class definitions

The prototype declaration of a class is as follows :


Class types

syntdiag2363

syntdiag2367

syntdiag2371

syntdiag2375

syntdiag2379

syntdiag2383

Again, You can repeat as many private, protected, published and public blocks as you want. Methods are normal function or procedure declarations.

As you can see, the declaration of a class is almost identical to the declaration of an object. The real difference between objects and classes is in the way they are created (see further in this chapter).

The visibility of the different sections is as follows:

Private
All fields and methods that are in a private block, can only be accessed in the module (i.e. unit) that contains the class definition. They can be accessed from inside the classes' methods or from outside them (e.g. from other classes' methods)
Protected
Is the same as Private, except that the members of a Protected section are also accessible to descendent types, even if they are implemented in other modules.
Public
sections are always accessible.
Published
Is the same as a Public section, but the compiler generates also type information that is needed for automatic streaming of these classes. Fields defined in a published section must be of class type. Array peroperties cannot be in a published section.


next up previous contents index
Next: Class instantiation Up: Classes Previous: Classes

Michael Van Canneyt
Fri Sep 25 09:15:40 MEST 1998