• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do we solve diamand problem in java

 
Ashuthosh san
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

How do i solve a diamond problem. Eg. I am giving the example in general . I have a class A, there are two other classes B and C which extends A and there is one more class D which extends both B and C. How do i deisgn this kind of scenario.

Regards
Asha
 
Pushkar Choudhary
Rancher
Posts: 425
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A Java class cannot extend more than one Java classes. For more information, read this.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There *is* no diamond problem in Java.
 
Ashuthosh san
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have one problem i have two classes A and B , i need both functionality of A and B in C. How do i do it?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably composition.
 
pratik gaurav
Greenhorn
Posts: 16
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Probably composition.

sir can you please explain us Probably Composition
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic