定义了个Person类,有个虚函数Get_Message();
Student类继承他而来,有个函数Get_Message();
我又建立了个类
typedef struct Node
{
Person *P;
Node *next;
Node(){}
}Node;
以及
class List
{
Node *head,*p1;
public:
List()
{
head=new Node;
head->next=0;
}
void get()
{
p1=head;
while(p1->next!=0)
{p1=p1->next;}
p1->P=new Student;
p1->P->Get_Message();
}
出现个错误。
C:\Documents and Settings\Administrator\桌面\147-3\main.cpp(150) : error C2039: 'Get_Messgae' : is not a member of 'Person'
是不能这么做吗?
那要怎么实现!
}