suppose we have three classes A,B,C. A is parent class of B and C. B is parent class of C.Can class C finish inheritance of class A and class B OR Can class A finish inheritance of class B and class C. If answer is yes how? Thankz in advance
"finish inheritance"??? A is a super class of B which is a super class of C. A | B | C All B's inherit from A. When you create a C it inherits from B, including the stuff from A.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Apr 27, 2001
A | B | C Actually my question is "Can an object of class A destroy the inheritance of class B and class C. Class C extands class B (I want to finish this relation ship through any object of other class)
Joined: Sep 29, 2000
So you mean can you stop being a subclass or a superclass suddenly? No, at least not dynamically - as you are executing. Class A can PREVENT subclassing by being final. like "public final class Math" And if it was not final, and there is a subclass, if you stop and make the super class "final" and recompile, and then try to run the subclass - you get a java.lang.VerifyError: Class B is a subclass of final class A