Hi, I thought that if I had a subclass that inherited form a parentclass, and both have a method with the same name (Bar), then the method of the subclass hid the method of the parentclass, and you could not call inherited Bar in the subclass.
More specifically I was under the impression that you could only call inherited in an overriden method that was declared virtual in the parentclass. program test; {$mode objfpc}{$H+} uses SysUtils, Classes; type TFoo = class procedure Bar; end; { TFooChild } TFooChild = class(TFoo) procedure Bar; end; procedure TFoo.Bar; begin writeln('TFoo.Bar'); end; { TFooChild } procedure TFooChild.Bar; begin inherited Bar; writeln('TFooChild.Bar'); end; var FooChild: TFooChild; begin FooChild := TFooChild.Create; FooChild.Bar; FooChild.Free; end. To my surprise this compiles without any warning or error. It outputs: C:\Users\Bart\LazarusProjecten\ConsoleProjecten>test TFoo.Bar TFooChild.Bar Why then would I need virtual and override anymore? Bart _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal