What is mean "Death of Diamod"?

What is mean "Death of Diamod"?

Death Diamond:-In object-oriented programming languages with multiple inheritance and knowledge organization, the diamond problem is an ambiguity that arises when two classes B and C inherit from A, and class D inherits from both B and C. If a method in D calls a method defined in A (and does not override the method), and B and C have overridden that method differently, then from which class does it inherit: B, or C?
 For example a class Button may inherit from both classes Rectangle (for appearance) and Clickable (for functionality/input handling), and classes Rectangle and Clickable both inherit from the Object class. Now if the equals method is called for a Button object and there is no such method in the Button class but there is an overridden equals method in both Rectangle and Clickable, which method should be eventually called? ihis is called "Death of Diamond".

Ex:
Class a
{
}
class b: a
{}
class c: a   
{}
class d:b,c
{}
      It is called the "diamond problem" because of the example of the class inheritance  in this situation. In this example, class A is at the top, both B and C separately inherit to A, and D inherits both......                   

By:kamal
Date:2013-10-10 00:00:00

Post Your Answers


User Email:

User Name:
Answers:

Related C Links

C interview questions and answers for experienced and fresher