The prototype declaration of a class is as follows :
TObj = Class [(ParentClassType)] [Constructor ConstructorName;] [Destructor DestructorName;] Field1 : Type1; ... Fieldn : Typen; Method1; Method2; [private PrField1 : PrType1; ... PrFieldn : PrTypen; PrMethod1; ... PrMethodn; ] [protected PuField1 : PuType1; .. Pufield1 : PuTypen; PuMethod1; ... PuMethodn; Property1; ... Propertyn; [public PuField1 : PuType1; .. Pufield1 : PuTypen; PuMethod1; ... PuMethodn; Property1; ... Propertyn;] [published PuField1 : PuType1; .. Pufield1 : PuTypen; PuMethod1; ... PuMethodn; Property1; ... Propertyn;]You can repeat as many private 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;
The visibility of the different sections is as follows:
Classes must be created using their constructor. Remember that a class is a pointer to an object, so when you declare a variable of some class, the compiler just allocates a pointer, not the entire object. The constructor of a class returns a pointer to an initialized instance of the object.
So, to initialize an instance of some class, you do the following :
ClassVar:=ClassType.ConstructorName;
Remark :