I have a base class that captures some functionality common to two classes. In other words, I can create one base class and make these two classes subclasses of that base cl
I'm not an expert in Java, so I don't know if this is technically legal Java code (perhaps another poster can comment):
Make the base classes inherit from a generic class Singleton.
Example:
class Singleton {
protected Singleton(); //constructor
private static T _instance;
}
class DerivedOne extends Singleton{
protected DerivedOne(){} //constructor
}
class DerivedTwo extends Singleton{
protected DerivedTwo(){} //constructor
}