Example of Member Function Search Path


/************************************************************************
*

The search of the enclosing classes, including inherited members, is demonstrated in the following example:

                                                                        *
************************************************************************/


class A { /* ... */ };
class B { /* ... */ };
class C { /* ... */ };
class Z : A {
      class Y : B {
            class X : C { int f(); /* ... */ };
      };
};
int Z::Y::X f()
{
   // ...
      j();
   // ...
}


/************************************************************************
*

In this example, the search for the name j in the definition of the function f follows this order:

  1. the body of the function f
  2. X and in its base class C
  3. Y and in its base class B
  4. Z and in its base class A
  5. the lexical scope of the body of f. In this case, this is global scope.



                                                                        *
************************************************************************/