Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In java, I have a situation : I wrote 3 classes A, B, C, class B extends class A and class C extends class B.
There is a method X() in class A, then I override in class B and override in class C, again.
Now declare a variable M type C. How could I call M.X() in which X() is belonged to class A.

Really need help :)

I code in java, using JDK 1.6.0
Posted
Updated 6-Jul-10 1:43am
v2
Comments
Pavel Yermalovich 6-Jul-10 7:36am    
Which programming language do you use?
Peter_in_2780 6-Jul-10 20:06pm    
Pavel, did you read the first two words of the OP's question, not to mention the last sentence?

I don't think you can do this. You could declare X() as abstract and just let each subclass implement it.
 
Share this answer
 
You can't, see here [^] (the competitors...) for a rationale.
:)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900