c++ - Can a class initialize its non-immediate base classes in its member initialization list? -
c++ - Can a class initialize its non-immediate base classes in its member initialization list? -
the next code excerpted apache c++ standard library user's guide
class derivedoutputstream : public std::ostream { public: derivedoutputstream(): std::ios(0), std::ostream(&dsb) {} //1 // ... private: derivedstreambuf dsb; // ... };
please note std::ios
not immediate base of operations class of derivedoutputstream
, appears in fellow member initialization list.
i think not correct, that?
it right if virtual base of operations class. virtual bases initialized derived class.
c++ inheritance constructor initialization derived-class
Comments
Post a Comment