Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2014-05

override or virtual override

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Xiangrong Fang

Hi All,

Is the property of "virtual" inherited? i.e. if a method in parent class is virtual, same method in child class is also virtual, right?

TBase = class
public
  destructor Destroy; override; //<-- is this enough
  destructor Destroy; virtual; override; //or this to ensure it is still
virtual?
end;

Thanks,

Xiangrong

Reply by email

Sven Barth
to Xiangrong Fang
"Xiangrong Fang" wrote
Hi All, Is the property of "virtual" inherited? i.e. if a method in parent class

is virtual, same method in child class is also virtual, right?

Show quoted text 5 lines
TBase = class public destructor Destroy; override; //<-- is this enough destructor Destroy; virtual; override; //or this to ensure it is still

virtual?

end;

"override" is an implicit "virtual" as long as the parameter lists of both methods are the same.

Regards,
Sven

Reply by email

Sven Barth
to Mattias Gaertner
"Mattias Gaertner" wrote 6 lines
On Mon, 5 May 2014 08:05:47 +0200 Sven Barth wrote: >[...] > "override" is an implicit "virtual" as long as the parameter lists of

both

> methods are the same. Huh? If they are not the same, it won't compile.

Yes... I left out that part :P

Regards,
Sven

Reply by email