How to access an abstract method
Posted on 2006-10-20
I'm new to java.
I have an abstract class A, with an abstract method "calculate()".
I extend from A, classes B, C, and D. The all implement "calculate()" differently.
I then put these classes as values into a MAP.
When I try to access the calculate() method using the .get method of the MAP, the compiler says that there is not calculate() method. "foo.get("add").calculate()"
How do I polymorphically get at the calculate method?
Any simple examples out there?