T
ThunderMusic
Hi,
I have a problem regarding singletons in C#. What I would like to do is the
following
ClassA is a singleton
ClassB inherits from ClassA and is also a Singleton
there cannot and instance of ClassA and an instance of ClassB, there must be
only one of one or the other...
Is there a way to do it? or it's simply not possible?
I tried to put the m_instance member variable protected, so the inherited
classes can see it, but the problem is when I have the method Instance(), it
returns the instance of ClassA, not the instance of classB, and if I
override it, I can't change it's return type... Is there a way to shadow the
original method which returns ClassA to replace it with a method that
returns ClassB?
Thanks
ThunderMusic
I have a problem regarding singletons in C#. What I would like to do is the
following
ClassA is a singleton
ClassB inherits from ClassA and is also a Singleton
there cannot and instance of ClassA and an instance of ClassB, there must be
only one of one or the other...
Is there a way to do it? or it's simply not possible?
I tried to put the m_instance member variable protected, so the inherited
classes can see it, but the problem is when I have the method Instance(), it
returns the instance of ClassA, not the instance of classB, and if I
override it, I can't change it's return type... Is there a way to shadow the
original method which returns ClassA to replace it with a method that
returns ClassB?
Thanks
ThunderMusic