Re: Singleton
- From: Jens Mühlenhoff <j.muehlenhoff@xxxxxxxxxxxx>
- Date: Thu, 17 Jan 2008 11:06:33 +0100
Chris Rolliston wrote:
IMHO, an implementation-specific global variable isA class field makes more sense than either one.
much neater than having a variable const!
Why, apart from enforcing a .Net framework-style verbosity in both
implementation and use?
1. To reduce the "usage verbosity" you can still have a global function to access the variable (see my other post).
2. A class var is a clean OOP mechanism and it's not .NET specific either. C++ has had class vars for ages now and I always missed them in Delphi 7.
You could even live without ever creating an instance of the class, since the class itself can have data (using class vars). Then you don't have to protect/hide your constructor to avoid misusage.
Taking this approach the usage would only be slidly more verbose:
TSingleton.Somemethod;
instead of
Singleton.Somemethod;
--
Regards
Jens
.
- Follow-Ups:
- Re: Singleton
- From: Chris Rolliston
- Re: Singleton
- From: Craig Stuntz [TeamB]
- Re: Singleton
- References:
- Singleton
- From: Alan T
- Re: Singleton
- From: Chris Rolliston
- Re: Singleton
- From: Chris Morgan
- Re: Singleton
- From: Craig Stuntz [TeamB]
- Re: Singleton
- From: Chris Rolliston
- Singleton
- Prev by Date: Re: Singleton
- Next by Date: Re: Garbage Collection
- Previous by thread: Re: Singleton
- Next by thread: Re: Singleton
- Index(es):