[fpc-pascal] Inherited and not virtual/overridden procedures

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Jun 12 00:19:37 CEST 2013


On 12 Jun 2013, at 00:12, Bart wrote:

> 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?

So that it would still have the same behaviour if you changed the variable declaration to

var
  FooChild: TFoo;


Jonas


More information about the fpc-pascal mailing list