Leandro,

On xbase++ you can create them this way

http://databear.wordpress.com/2009/08/28/xbase-singleton-pattern/

Maybe you can adopt this to harbour.

Maurilio.

Thank you Maurilio

The author suggests to use class var and class methods to implement singleton behaviour in xbase++. In most cases this aproach would work in practice for sure in harbour too, but just as a workaround, because Singleton pattern is about the class instantiation. The aproach suggested to xbase++ would force the programmer to use the CLASS clause repeatedly to every DATA and METHOD declaration, even when he wants for sure unique access to all the members of a class.

I believe it would be usefull and simpler if one could just declare a class as Singleton and have always acess to the same object instance when calling the class by name.

What do you think?

Regards,
Leandro Damasio



_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to