Skip to content

Inheritance

Dániel Segesdi edited this page Aug 14, 2015 · 6 revisions

Includes

Direct includes are necessary to super classes (details: wiki)

Inheritance

namespace GeneralizationTest{
namespace Component{

class D : public ::GeneralizationTest::Component::A, public ::GeneralizationTest::Component::C {
    ...
}
}
}

Constructor

::GeneralizationTest::Component::D::D(int i) : ::GeneralizationTest::Component::A::A(i), ::GeneralizationTest::Component::C::C(1.0) {
    _instances.push_back(this);
    bool result = true;
}

Important information

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).

Clone this wiki locally