Is calling a base class constructor always necessary in C ++?

Suppose I have a class C, and I inherit it and call this class D. Do I always need to call the default constructor Cby default:

class C {
    public:
        C() { ... }
};

class D {
    public:
        D() : C() { ... }
};

Note that Conly the default constructor has it. Should I call him from D? I could not figure out how to figure this out.

Thanks, Boda Sido.

+3
source share
1 answer

. , . , .

+10

Source: https://habr.com/ru/post/1753099/


All Articles