[fpc-devel] Class property and virtual getter
jonas.maebe at elis.ugent.be
Thu Feb 27 16:35:20 CET 2014
On 27 Feb 2014, at 12:40, luiz americo pereira camara wrote:
> Removing class before property compiles. But if i try to access the
> property using TSimpleModel.ResourceClient gives the following error:
> Error: Only class methods, class properties and class variables can be
> referred with class references
You have to declare an instance and then call its property. You don't
have to instantiate the instance if the property maps to a class method.
> Technically there's some obstacle to allow such construct?
Class properties should be accessible from within static class
methods. Having them accessible depending on the getter/setter they
use (static or not) would break orthogonality (the visibility/
usability must depend on the interface, not on the implementation of
Non-static class methods cannot be called from static class methods
because you don't know the original class type that was used to call
it (and hence this could have unexpected results).
More information about the fpc-devel