+ 2

C++ supports multiple inheritance. What is the “diamond problem” that can occur with multiple inheritance? Give an example.

15th Aug 2017, 3:21 AM
ⓢⓐⓝⓓⓔⓔⓟ
ⓢⓐⓝⓓⓔⓔⓟ - avatar
4 Answers
+ 3
@Drauchris Thank you, for explaining!
15th Aug 2017, 4:51 AM
Manual
Manual - avatar
+ 2
well. i think i can explain it like this. you have a class class cat with the property Legs and a dog class with the property legs. now you define a class CatDog which inherits from those both classes. now you have two Legs-Properties. Problem
15th Aug 2017, 4:32 AM
Drauchris
Drauchris - avatar
0
and how do you avoid the diamond problem?
16th Aug 2017, 6:22 PM
GodBlessAmericasFrog
GodBlessAmericasFrog - avatar
0
namespaces for example
17th Aug 2017, 7:10 AM
Drauchris
Drauchris - avatar