[fpc-pascal] class property accessor static
hnb.code at gmail.com
Tue Feb 7 14:19:18 CET 2017
2017-02-07 13:51 GMT+01:00 Mattias Gaertner <nc-gaertnma at netcologne.de>:
> Why is that "more handy"? "static" does not have a Self. That
> is less handy, isn't it?
by "handy" I mean usage of "class properties" instead of "static methods".
> I can't follow you here. Are we still talking about why Delphi choose
> static instead of normal?
"class property" is used for code where class instance (nor assign to meta
class) is not needed. Some variance/idea of singleton pattern. TFoo might
be used as namespace:
Foo: TFooClass; // or Foo: TFoo
for regular "property" with "class methods" you need something like this:
Foo := TFoo;
and for normal property:
Foo := TFoo.Create;
> OTOH you loose some possibilities.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal