[fpc-pascal] Class vs Object type

Sven Barth pascaldragon at googlemail.com
Wed Apr 6 17:09:41 CEST 2016


Am 06.04.2016 16:28 schrieb "Dennis" <dec12 at avidsoft.com.hk>:
>
> objects unit contains
>    TObject = OBJECT
>       CONSTRUCTOR Init;
>       PROCEDURE Free;
>       FUNCTION Is_Object(P:Pointer):Boolean;
>       DESTRUCTOR Done;  Virtual;
>    END;
>
>
> On the other hand, objpash.inc contains
>        TObject = class
>        public
>           { please don't change the order of virtual methods, because
>             their vmt offsets are used by some assembler code which uses
>             hard coded addresses (FK)                                 }
>           constructor Create;
>          .....
>
> That is so confusing.
> What are other real benefits in inheriting from object unit's TObject?

It's mainly there for backwards compatibility with TP code. It's also the
base class of the FV object hierarchy.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20160406/dc37c129/attachment.html>


More information about the fpc-pascal mailing list