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

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to