I have a problem with assigning the same objects with multiple inheritance which also have diamond problem. Here is the skeleton code of my project.
H.h
class H
{
protected:
int a;
int b;
int c;
public:
H();
H(int a);
//Setter and getters
};
Y.h
class Y : virtual H
{
public:
Y();
Y(int a);
};
D.h
class D : virtual H
{
public:
D();
D(int a);
};
An.h
class An : Y , D
{
public:
An();
An(int a);
};
I would like to assign one An object to another. But i get this error: error C2582: 'operator =' function is unavailable in 'An' I searched google but found nothing. I am working on Visual Studio 2010
It works on Y or D or H like :
int main()
{
Y *a = new Y[4];
Y *b = new Y[4];
a[0] = b[0];//this is not the problem
}
Main.cpp
int main()
{
An *a = new An[4];
An *b = new An[4];
a[0] = b[0];//this is the problem
}
How can i solve this problem. Thanks in advance.