nathanChun
asked on
How to access an abstract method
Dear Expert:
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?
Thanks
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?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER