[fpc-pascal] FPC class syntax was extended to support delphi code
Andreas Schneider
aksdb at gmx.de
Thu Jan 14 15:50:50 CET 2010
I think they come in very handy for the Singleton OOP concept. You need to
have a "factory" that handles the object query/instantiation. If no instance
is available, it creates a new one (and stores it) and if one is already
available, it just returns that.
Naturally that looks better to have TSomeClass.GetInstance() instead of
GetInstanceOfSomeClass() ...
Sure, it's possible to do without class methods, but from an OOP viewpoint it
just looks and feels wrong ;-) (imho)
Am Donnerstag 14 Januar 2010 01:50:02 schrieb Doug Chamberlin:
> Oh, I can imagine such methods also. And I've used them before. I just
> don't see the big advantage over having them be global
> functions/procedures located in the same unit as the class they operate
> on. So, as often as not, I go and create the global functions instead.
> Never could decide either way to go.
>
More information about the fpc-pascal
mailing list