Original Post
Hi
I''ve just come across a problem with a singleton class that I have just made, which is everything works as it should until I derive a new class from it and try to override a function - the problem being that it still calls the base function even tho it''s been overridden with a new one. I understand why this happens, being the nature of a singleton, but is there a way to get around this? Or am I going to have to rethink my strategy as far as using singletons is concerned?
Actually, I think i''ve got around it, but i''m not sure whether this is
a) an elegant solution
b) defying the point of using a singleton
What I did was to derive a new class from the base singleton class, then in the constructor, create the singleton.
In the destructor, i deleted the singleton.
Then in the main app space, I simply created a new instance of the derived class, and used it/delete it as normal.
Do I win?