Link to home
Start Free TrialLog in
Avatar of 47pitch
47pitchFlag for United States of America

asked on

derived class constructor

in C++, does a derived class constructor "automatically" call the base class constructor?
Avatar of jkr
jkr
Flag of Germany image

Yes - more specifically, the default constructor is called - if you need another ctor, you can call it in the derived class' ctor's initializer list. See also e.g. http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8a.doc%2Flanguage%2Fref%2Fcplr388.htm ("Initializing base classes and members (C++ only)"): "If you do not explicitly initialize a base class or member that has constructors by calling a constructor, the compiler automatically initializes the base class or member with a default constructor."
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial