Multiple access (C++ only)

In an inheritance graph containing virtual base classes, a name that can be reached through more than one path is accessed through the path that gives the most access.

For example:

class L {
  void f();

class B1 : private virtual L { };

class B2 : public virtual L { };

class D : public B1, public B2 {
  void f() {
    // L::f() is accessed through B2
    // and is public

In the above example, the function f() is accessed through class B2. Because class B2 is inherited publicly and class B1 is inherited privately, class B2 offers more access.

Related information