E
Edward A Thompson
Is there any reason that the Factory Pattern cannot be implmented with
a static getClass method in the base class?
Rather than instantiate a factory, then call its getClass method (2
steps):
CalculatorFactory f = new CalculatorFactory ();
Calculator c = f.getClass(someIndentifyingString);
I was thinking of instantiating the final class I want by calling a
static method in the base class:
Calculator c = Calculator.getClass(someIndentifyingString);
Is there a flaw in this strategy? What am I missing?
a static getClass method in the base class?
Rather than instantiate a factory, then call its getClass method (2
steps):
CalculatorFactory f = new CalculatorFactory ();
Calculator c = f.getClass(someIndentifyingString);
I was thinking of instantiating the final class I want by calling a
static method in the base class:
Calculator c = Calculator.getClass(someIndentifyingString);
Is there a flaw in this strategy? What am I missing?