What does it mean when "virtual" is in the "class Foo: public virtual Bar" as opposed to "virtual void frob ()"?

What does it mean when "virtual" is in the "class Foo: public virtual Bar", as opposed to "virtual void frob ()"?

For this method, there are 8 cases associated with the presence or absence of a virtual in the following three places.

  • Superclass Functions
  • Inheritance chain for this class.
  • These are class functions.

I think I understand how the numbers 1 and 3 interact, but the number 2 seems redundant. It? What? I do not understand?

+7
c ++ virtual
source share
1 answer

This is virtual inheritance , you do this when you know that you will do multiple inheritance. This page goes in more detail.

+11
source share

All Articles