-
Notifications
You must be signed in to change notification settings - Fork 1
Inheritance
Dániel Segesdi edited this page Aug 14, 2015
·
6 revisions
Direct includes are necessary to super classes (details: wiki)
namespace GeneralizationTest{
namespace Component{
class D : public ::GeneralizationTest::Component::A, public ::GeneralizationTest::Component::C {
...
}
}
}
::GeneralizationTest::Component::D::D(int i) : ::GeneralizationTest::Component::A::A(i), ::GeneralizationTest::Component::C::C(1.0) {
_instances.push_back(this);
bool result = true;
}
If the superclass has a default constructor (constructor with no parameters) it is not necessary to be specified in the initialization list.
One of the super class's constructors will always be called in the child class (if there is a default constructor in the super class it does not have to be called explicitly).