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.


Leandro Damasio wrote:
> Hi,
>  
> My name is Leandro Damasio and I have started to follow Harbour Project
> Main Developer List few days ago. I recently started 2D Informatica with
> my associate Ted, to develop commercial aplications using [x]Harbour. We
> used xHarbour + BCC55 + HWGUI for about 3 years, until we read
> xhb-diff.txt document and decided to try Harbour instead.
>  
> We are about to realease 2DWGUI, an Object Oriented Harbour API to Win32
> GUI, and its going to be a free product but not opensource from start.
>  
> Our experience with opensource development is minimal, but I believe we
> could be useful by giving sugestions and/or reporting problems at least.
>  
> My first try:
>  
> Does harbour have native support to singleton classes? Its an useful
> design pattern to declare unique instance objects, so the same instance
> is reacheable/accessible globally by just calling for the the class name.
> We implemented Singleton objects in xHarbour, but I'm sure the native
> implementation should be done better by someone who knows the object
> machine inside.
>  
> The Singleton Class usage is like below:
>  
> <code>
>  
> CLASS Aplication SINGLETON
>  
>     DATA Status
>  
>     METHOD Init(aParams)
>     METHOD Run()
>     METHOD End()
>  
> ENDCLASS
>  
>  
> Procedure Main (...)
>  
> Aplication():Init(hb_aParams())
>  
> Func2()
>  
> Aplication():End()
>  
> Return
>  
>  
> Static Function Func2()
>  
> Aplication():Run()
>  
> Return Aplication():Status
>  
> </code>
>  
> If it is not implemented yet, do you think its a good idea to implement
> natively?
>  
> Thanks
> Leandro Damasio
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Harbour mailing list (attachment size limit: 40KB)
> Harbour@harbour-project.org
> http://lists.harbour-project.org/mailman/listinfo/harbour

-- 
 __________
|  |  | |__| Maurilio Longo
|_|_|_|____| farmaconsult s.r.l.


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

Reply via email to