struct student
{
int number;
char name[10];
};
struct MyStruct
{
CList so;
};
struct MyS:public MyStruct
{
void print()
{
student os;
os = { 10, "hao" };
so.AddHead(os);
}
};
struct myd :public MyStruct
{
void print2()
{
student os;
os = { 10, "ha" };
so.AddHead(os);
}
};
struct MyStr:public MyS,public myd
{
};
int main()
{
MyStr sp;
sp.print();
sp.print2();
}
为什么print()和print2()里面的&so不同
struct student
{
int number;
char name[10];
};
struct MyStruct
{
CList so;
};
struct MyS:virtual public MyStruct
{
void print()
{
student os;
os = { 10, "hao" };
so.AddHead(os);
}
};
struct myd :virtual public MyStruct
{
void print2()
{
student os;
os = { 10, "ha" };
so.AddHead(os);
}
};
struct MyStr:public MyS,public myd
{
};
int main()
{
MyStr sp;
sp.print();
sp.print2();
}
为什么这两print()和print2()里面的&so却相等呢?????????????