为什么在VC编译环境下怎么不能实现多太
#include"iostream.h"
class Basic
{
public:
virtual void f()
{
cout<<"In Base \n";
}
};
class descent:public Basic
{
public:
virtual void f()
{
cout<<"In descent \n";
}
};
void detect(Basic d)
{
d.f();
}
void main()
{
Basic d;
descent b;
detect(d);
detect(b);
}
为什么这段代码在Microsoft Visual C++6.0环境下输出都是“In Base”