Instantiating Objects within Abstract Class or Concrete Class?
I have an abstract class with several member classes in it in addition to the abstract methods
Code:
public abstract class AbstractClass{
protected ClassA classA;
protected ClassB classB;
...
public abstract void method1( ArgClass arg, ... );
public abstract void method2( ArgClass arg, ... );
...
public AbstractClass() {
class A = new ClassA(); // not sure whether I should instantiate these members here
class B = new ClassB(); // or if I should instantiate them in a derived (concrete) class.
}
}
public class ConcreteClass extends AbstractClass{
public ConcreteClass() {
class A = new ClassA(); // not sure whether I should instantiate these members here
class B = new ClassB(); // or if I should instantiate them in a superclass (abstract)
}
public void method1( argument )
{
... method2 definition
}
public void method1( argument )
{
... method2 definition
}
}
Can anyone help me with this seemingly simple issue.
Thanks,
EVAC