Pascal Objet


Pascal Object (or Object Pascal ) is an object-oriented language derived from Pascal . It was created in 1990 by the company Borland as an improvement of its flagship software of the time, Turbo Pascal . This was version 5.5. Even if the addition of the object to the Turbo Pascal was smooth and was sold by Borland as a simple and logical improvement of Turbo Pascal, it has nevertheless revolutionized this language and the community of developers who Was associated with him.

The Pascal Objet took a new lease of life in 1995 with the release of Delphi 1, still on the initiative of Borland.

Declaration of an object type

 Type
 TMonObjet = object
 string: string ;
 Constructor NewObject;
 Destructor DetruitObjet;
 Procedure ObjectExec;
 End ;
End ;
Procedure TMonObjet.ObjetExec;
Beginners
 WriteLn (string);
End ;

Note: The keyword object​was accompanied by the keyword class​with Delphi . Both are object types but with some slight differences. For example, a class is implicitly a pointer , that is, the pointer is created and managed implicitly and transparently without the programmer having to deal with it, while an object is not automatically pointed , The programmer having to point it manually and quasi systematically.

Using an object

Using the above definition:

Var
 Obj: TMonObjet;
Beginners
 Obj: = TMonObject.NewObject;
 Obj.Chaine: = 'Abracadabra' ;
 Obj.ObjectExec; {Poster 'Abracadabra'}
 Obj.DetruitObject;
End ;