[fpc-devel] Class property and virtual getter

Michael Van Canneyt michael at freepascal.org
Thu Feb 27 16:06:40 CET 2014



On Thu, 27 Feb 2014, Hans-Peter Diettrich wrote:

> Michael Van Canneyt schrieb:
>
>>> So what's the special use of a *class* property? If it exists for Delphi 
>>> compatibility only, why then is it handled differently from "property"?
>> 
>> 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.

> so this protection looks very artifical to me.

Nevertheless, this is the reason.

Michael.



More information about the fpc-devel mailing list