asheeshr
asheeshr

Reputation: 4114

What is the use of virtual base class in multilevel inheritance?

This was an exam question.

Write a program demonstrating the use of virtual base classes in multilevel inheritance.

I cannot think of any scenario in which a virtual base class would actually make any difference in the specific case of multilevel inheritance.

The only possible answer to the question i can think of is to show hybrid inheritance(the diamond) which contains multilevel inheritance in it.

Any ideas would be appreciated.

Upvotes: 1

Views: 590

Answers (1)

totymedli
totymedli

Reputation: 31058

You answered your question. The answer is the case with the diamond. For the reason and why to use see this question:
In C++, what is a virtual base class?

Upvotes: 2

Related Questions