8

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

For a given method there are 8 cases stemming from the presence or absence of virtual in the following three locations.

  1. A superclass's functions.
  2. The inheritance chain for this class.
  3. This classes functions.

I think I understand how numbers 1 and 3 interact but number 2 seems redundant. Is it? What am I not understanding?

4

1 に答える 1

11

これは仮想継承です。多重継承を行うことがわかっている場合に行います。そのページはさらに詳細になります。

于 2009-05-08T17:36:07.713 に答える