0

In C++, how to call derived class constructors if base class also has parameterized constructor?

I have a simple base class in my program. Its constructor takes parameters. I have a derived class that also has its own parameters in its constructor. Why does it return an error if i create an instance of the derived class? Do i first need to pass parameters to the base class then derived class?

7th Jul 2020, 8:14 PM
Kisembo Allan
Kisembo Allan - avatar
2 ответов
+ 1
Define a default constructor (i.e ...no params) in your base class.
7th Jul 2020, 8:19 PM
rodwynnejones
rodwynnejones - avatar
7th Jul 2020, 8:26 PM
rodwynnejones
rodwynnejones - avatar