File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "inheritance" Watch "inheritance" New topic
Author

inheritance

atif toor
Greenhorn

Joined: Apr 27, 2001
Posts: 9
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
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
"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
atif toor
Greenhorn

Joined: Apr 27, 2001
Posts: 9
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)
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
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
atif toor
Greenhorn

Joined: Apr 27, 2001
Posts: 9
Thankz Cindy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: inheritance