I have a parent type, and there are some types of children inheriting it.
I want to make sure that there is only one instance of the parent, as well as for all types of children. Parent Type:
private static int _instanceCount = 0; public ParentClass() { protected ParentClass()
Example child class:
private static int _instanceCount = 0; public ChildClass() : ParentClass { public ChildClass() : base()
The solution works for types of children, but when they call the constructor of the base class, I cannot tell if the base constructor is called from other types or not, so the solution does not work.
How can i achieve this?
source share