I am trying to have multiple instances of the same class in a parent class. Each with their own constructor arguments.
I have tried this, but not sure how to fix this. Any help would be greatly appreciated.
Base.h
class Base
{
public:
Base(int a, int b);
};
Parent.h
#include "Base.h"
class Base_A :Base{};
class Base_B :Base{};
class Parent : Base_A, Base_B
{
public:
Parent (int a1, int a2, int b1, int b2);
}
Parent.cpp
Parent::Parent (int a1, int a2, int b1, int b2) :Base_A(a1,a2), Base_B(b1,b2)
{
//....
}
When compiling I get the following error:
no instance of constructor "Base_A::Base_A" matches the argument list -- argument types are: (int, int)
no instance of constructor "Base_B::Base_B" matches the argument list -- argument types are: (int, int)