You can call base class constructors. Therefore, if you define Baseas follows.
class Base
{
public:
Base() {};
Base(int i, double j) : m{i}, l{j} {};
Base(int i, double j, char ch) : m{i}, l{j}, n{ch} {};
virtual void print() { std::cout << "Base" << std::endl; };
private:
int m;
double l;
char n;
};
Derived , Base -.
class Derived : public Base
{
public:
Derived() : Base() {}
Derived(int i, double j) : Base(i, j) {}
Derived(int i, double j, char ch) : Base(i, j, ch) {}
void print() override { std::cout << "Derived" << std::endl; };
};
int main()
{
Base b1{};
Base b2{1, 2};
Base b3{1, 2, 'a'};
Derived d1{};
Derived d2{1, 2};
Derived d3{1, 2, 'a'};
}