How do I inherit from a singleton class into other classes that need the same functionality? Would something like this make any sense?
Someone feel free to correct me, but the way I understand it, and had an error with this once:
public class BaseClass
{
protected static List ListOfSomething { get; set; }
}
public class ChildClass
{
protected static List ListOfSomethingElse { get; set; }
}
public class AnotherChildClass
{
protected static List ListOfSomethingElse { get; set; }
}
Both of the child classes would share the same ListOfSomething
, they would not have their own copy. The same static one would be shared amongst all children. This is the molt of singleton behavior and inheritance. As silky said...you just shouldn't do it, you'll probably run into something along these lines.
If you're not talking about something like this...I'm not sure what singleton you're speaking of, and an example would help greatly, since singleton's have a great deal of niche uses.