Search This Blog

Saturday, November 14, 2009

C++, Derived Class Constructor

In Derived class' constructor:
  • Call base's class constructor if you have to, do now directly access the base's member. you might not have access, and it's the base's constructor's work anyway.
  • Derived class can only call the immediate base class constructor. p915, c++ primer
  • Do not pass base's member to the base constructor. Because you are passing the value that might not be initialized yet (p.919, c++ primer)

No comments: