|
-
March 15th, 2009, 01:35 PM
#1
Multiple inheritance and virtual functions.
Hello everyone.
I've recently been working with OO in C++ after switching from about a year of programming exclusively in Java.
Since I have no experience with multiple inheritance I've been Googling trying to find an answer to my question but can't find one.
Suppose I have classes A, B, C, D, and E.
The hierarchy looks as follows:
Code:
A
|
|-----
| |
B C
| |
| |
D |
| |
|---- |
|
E
This is, B and C inherit from A, and D inherits from B, and E inherits from D and C.
I understand this is a typical example of the "diamond" problem and that the best way to fix the ambiguity is through defining the parents of the subclass as 'virtual'.
However, in this case, do I want to define only D and C as virtual, or D B and C as virtual, or just B and C as virtual?
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|