[fpc-pascal] class property accessor static

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Tue Feb 7 14:31:10 CET 2017

On 2017-02-07 13:19, Maciej Izak wrote:
> "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:
> ===code begin===
> var
>   Foo: TFooClass; // or Foo: TFoo
> begin
>   WriteLn(Foo.F);
> end;
> ===code end===

Couldn't that simply be....



I never understood Object Pascal's class methods/properties either?
Unlike Java, not everything needs to be in a class. We are allowed to
have procedures or functions, and global ones at that. So in Object
Pascal we could simply have a unit called FooStuff where everything
related to Foo is defined, then have a global function F() and then use
it as follows...



fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal

My public PGP key:  http://tinyurl.com/graeme-pgp

More information about the fpc-pascal mailing list