[fpc-devel] Class property and virtual getter
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Fri Feb 28 01:57:48 CET 2014
Michael Van Canneyt schrieb:
>>> The reason is explained in the upcoming docs.
>>>
>>> Namely: a static method cannot be overridden.
>>
>> Sure, but virtual methods (including class methods) can be overridden.
>>
>>> The class property is part of this particular class, and descendent
>>> classes should not be able to override it's behaviour.
>>
>> A static class method can call another virtual class method,
>
> No, it cannot. Try it. It was explained to me using this exact example.
Then I missed the "static;" directive in the posted example, added to
the getter/setter methods. Delphi introduced that directive after D7,
and I found no useful description for it yet. Now it looks to me as if
we have to distinguish ordinary static (non-virtual) methods from
explicit "static;" methods.
DoDi
More information about the fpc-devel
mailing list