Search This Blog

Sunday, November 15, 2009

C++, Multiple Inheritance Scope

  • All the immediate base classes are searched simultaneously. (find out ambiguity in the multiple bases. e.g. same variable, same function in different base classes) p.988 primer
  • If you redefine a member (data or function, and not virtual function), you hide the member in the upper inheritance chain. Sometimes if you need the overload across inheritance chain, you can use "using trick" to bring the immediate base class under your scope. p.993 primer exercise. (this is necessary because function overload only appear in the same scope)
  • Scope can be resolved legally(found and no ambiguity), but still an error at last because "access" is not legal. Visibility does not equal accessibly. p.987 Primer

No comments: