[fpc-devel] Class property and virtual getter

Michael Van Canneyt michael at freepascal.org
Thu Feb 27 09:52:35 CET 2014



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

> Sven Barth schrieb:
>
>>> Changing the GetResourceClient method from virtual to static works
>>> 
>>> Is this a bug or by design?
>> As Michael said this is by design. If you want to use a non-static class 
>> procedure you must not use "class property", but only "property" (yes, that 
>> works).
>
> 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. 
The class property is part of this particular class, and descendent classes 
should not be able to override it's behaviour.

Michael.



More information about the fpc-devel mailing list