[fpc-pascal] Implementing a true Singleton - Can we decrease the visibility of a method?

Daniël Mantione daniel.mantione at freepascal.org
Fri Dec 8 19:15:54 CET 2006



Op Fri, 8 Dec 2006, schreef Micha Nelissen:

> Btw, I think singletons are nonsense too. Why is a global variable evil,
> and a singleton class not ?

Well, a singleton can hide and/or protect its private data.

Actually, a unit is a singleton. The procedures are the methodes, the 
interface declares the public methode and the implementation the private 
methods. The constructor is the initialization section and the destructor 
the finalization section.

But, in pure OOP the unit concept does not exist. I interpret the 
singleton as the OOP equivalent of the unit.

Daniël


More information about the fpc-pascal mailing list