I am currently trying to implement a hirachy of inherited classes in my project. Therefore I am using member initializer-lists and "pipe" a reference to a variable all the way down to the base class. I am really not sure, why I am getting a compiler error.
I have already tried to change the reference "int &id" to a pointer "int* id". The example below above is just a minimal example that points out my problem:
class Base
{
public:
    int& m_id;
    Base(int &id)
        : m_id(id)
    {
    }
};
class Derived1: virtual public Base
{
public:
    Derived1(int &id) : Base(id)
    {
    };
};
class Derived2: public Derived1
{
public:
    Derived2(int &id) : Derived1(id)
    {
    };
};
int main()
{
   int i = 13;
   Derived2 Test(i);
}
I am getting the following error message when trying to compile:
"error: no matching function for call to ‘Base::Base()’"
Any idea, what I am doing wrong?
Thanks for your help.
 
     
    