Am 20.08.2013 09:36 schrieb "Antonio Fortuny" <a.fort...@sitasoftware.lu>:
>
>
> Le 20/08/2013 07:34, Xiangrong Fang a écrit :
>>
>> Hi Flavio,
>>
>> Your findings confirmed mine, but not telling me why? It seems that the
"virtual" keyword has no use at all!   To confirm this, I just removed the
"inherited" call in TDerived, then re-run the program with or without
"virtual/override", the result is exactly same, i.e. with c2 (declared as
TBase), the following statements ALWAYS calls constructor of TDerived, NOT
TBase:
>>
>> c2 := TDerived.Create;
>> c2 := TBase(TDerived.Create);
>>
>> This is not same as the description in:
http://www.freepascal.org/docs-html/ref/refsu26.html
>>
>> BTW, the above documents are talking about objects, but I am using
classes, is there any difference here?
>
> Yep: a class is a construct definig a collection of variables, properties
and methods whilst an object is an instantiated class.

You are aware that the link mentioned by Xiangrong Fang points to a part of
the manual about Turbo Pascal style objects which are different in a
different sense to Delphi style objects/classes?

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

Reply via email to