I have three classes; A, B and C:
class A
{
public:
A() {}
protected:
int x = 0;
int y = 0;
};
class B
{
public:
B() {}
protected:
int x = 1;
int y = 1;
};
class C : public A, B
{
public :
C() {}
};
I want x member of C to be the one from A, and y member of C to me that from B. How can I do this? Since I've written class C : public A, B, now both C.x and C.y are 0. I have this problem in general when I have multiple inheritance and I want to inherit some members from one parent and some members from the other. Is there an option similar to the one for member functions, where one can use the keyword using to choose which function will be used?