请教:关于引用
#include<iostream>
using namespace std;
class Base
{
public:
void show()
{
cout<<"in the base class";
}
};
class Sub:public Base
{
public:
void show()
{
cout<<"in the sub class";
}
};
int main()
{
Sub s;
Base b=s;
b.show();
}
程序输出为in the base class
把Base b=s改为Base &b=s;在VC6里结果会是in the sub class,而在mingw里确还是一样,搞不懂什么问题,请高手指点!谢谢