[fpc-pascal] Turbo Pascal and Object Pascal ways of OOP

Daniël Mantione daniel.mantione at freepascal.org
Tue Feb 5 13:50:01 CET 2008



Op Tue, 5 Feb 2008, schreef Luiz Americo Pereira Camara:

> can i safely use the below object  instead of the record and pass directly to 
> the c function?
>
> TMyObj = object
> x: Integer;
> y: Integer;
> Method1;
> Method2;
> end;
> PMyObj = ^TMyObj;

Yes, objects (by specification) are defined to have the same binary layout 
as records.

> Moreover, whats the difference between objects and records with methods (the 
> new Delphi feature)?

Objects can have virtual methods, constructors, destructors. The new 
Delphi feature cannot.

Daniël


More information about the fpc-pascal mailing list