Assume a class like this:
struct Base { Base() { ... } Base(int) { ... } Base(int,string) { ... } ... };
I would like to inherit many classes from Base
, so I write
struct Son : public Base { Son() : Base() { } Son(int) : Base(int) { } Son(int,string) : Base(int,string) { } }; struct Daughter : public Base { Daughter() : Base() { } Daughter(int) : Base(int) { } Daughter(int,string) : Base(int,string) { } };
and I donβt need to add code to child constructors. Is it possible to inherit them implicitly? To call them the same way as in Base
, just change the name? The preprocessor can be abused here, but is there any other workaround?
source share