How to solve diamond problem with respect to this question | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to solve diamond problem with respect to this question

https://code.sololearn.com/cN8ooITzX7x1/?ref=app

30th Sep 2021, 3:55 PM
Ajoh Pv
Ajoh Pv - avatar
8 Answers
+ 2
Ajoh Pv To solve diamond problem you have to create "default" method not "abstract" method because interface abstract method can not have method body https://code.sololearn.com/cRffHX3lFIEg/?ref=app
30th Sep 2021, 5:47 PM
A͢J
A͢J - avatar
+ 1
Ajoh Pv Ok means when multiple inheritance is not possible then we use interfaces. We can achieve multiple inheritance using interface
30th Sep 2021, 5:34 PM
A͢J
A͢J - avatar
+ 1
Ajoh Pv Interface should not have method body. We just use interfaces to define abstract method which can be implement in a class but this abstract method can not have method body.
30th Sep 2021, 5:35 PM
A͢J
A͢J - avatar
0
What is diamond problem?
30th Sep 2021, 4:18 PM
A͢J
A͢J - avatar
0
When you can't inherit from two classes to a subclass(diamond problem)then you inherit a method from interfaces to a class I am not able to solve this issue here
30th Sep 2021, 4:42 PM
Ajoh Pv
Ajoh Pv - avatar
0
K thanks
1st Oct 2021, 12:54 AM
Ajoh Pv
Ajoh Pv - avatar
0
What is super ? Why is it used
1st Oct 2021, 12:58 AM
Ajoh Pv
Ajoh Pv - avatar
0
Ajoh Pv As this represents current class object same super represents parent class object. super is used to access parent class members.
1st Oct 2021, 2:15 AM
A͢J
A͢J - avatar