[fpc-pascal] Published -> Public

Marc Weustink marc at dommelstein.net
Sun Apr 18 00:57:24 CEST 2010


Martin wrote:
> procedure TChild.Foo;
> begin
>   inherited;  // or:  inerithed Foo;
>   // do more
> end;
> 
> I thought that in this last case, the compiler would know, that 
> inherited points to TBase.Foo; and the compiler would optimize the code, 
> to call directly (skipping the VMT) ?
> 
> But I guess I am wrong about that? OR how else could the above work?

Your correct, thats why toyu are not allowed to use inherited in these 
classes, but
   procedure TChild.Foo;
   begin
     TBaseClass(ClassParent).Foo;
     // do more
   end;

Marc




More information about the fpc-pascal mailing list