#include <iostream>
using namespace std;
class shox
{
public:
virtual void nba()
{cout<<1<<endl;}
public:
int index;
};
class vc:public shox
{
public:
virtual void nba()
{cout<<2<<endl;}
};
class carter:public shox
{
public:
virtual void nba()
{cout<<3<<endl;}
};
int main()
{
shox *text[2];
vc VC;
carter CARTER;
text[0]=&VC;
text[1]=&CARTER;
cout<<text[0]->nba<<endl;
cout<<text[1]->nba<<endl;
}
我这个为什么实现不了多态性~~~输出的全是1~是什么原因??????