• Post Reply Bookmark Topic Watch Topic
  • New Topic

Tell Me the Logic For this  RSS feed

 
Subhash Pavuskar
Ranch Hand
Posts: 57
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

There Are 4 classes say X,Y,Z,A where X extends Y i.e (X->Y) and Z extends A i.e (Z->A)
write a new class called B in which Y extends A without modifying the class Y and A.
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java doesn't have multiple inheritance, so you can't extend two unrelated classes at the same time. You could if one of them was an interface, though.

Maybe I've misunderstood what you're trying to do. What's the point? What are you trying to achieve?
 
Subhash Pavuskar
Ranch Hand
Posts: 57
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matthew Brown wrote:Java doesn't have multiple inheritance, so you can't extend two unrelated classes at the same time. You could if one of them was an interface, though.

Maybe I've misunderstood what you're trying to do. What's the point? What are you trying to achieve?


Sorry i reposted my Question please go through it.
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, but I still don't think it makes sense.
a new class called B in which Y extends A

What do you mean? How can Y extend A in B?
 
Campbell Ritchie
Marshal
Posts: 56536
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe it’s an inner class.

You need to draw a digram of those classes to understand them. Pencil, paper and eraser; the latter is the most important. It will be possible to draw such a diagram; it will probably be slightly simpler than this one.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!