Calling a base class method from a derived constructor

class Base {
    public:
    Base() {}

    void Foo(int x) {...}
};

class Derived : public Base {
    public:
    Derived(int args) {
        /* process args in some way */

        Foo(result);
    }
};

Is it allowed to call the base class method in the constructor of the derived class? I would suggest that this is normal, since the base object should be fully built, but I wanted to check just in case.

+5
source share
2 answers

Is it allowed to call the base class method in the constructor of the derived class?

. virtual. , Derived, , Derived - Derived, , , . ( , BTW.)

, , , .

.

+11

, :
 1.  2.

+1

All Articles