c++编程使用派生类出现如下错误怎么回事啊
#include<iostream>#include<string>
using namespace std;
class student
{private:
int num;
string name;
char sex;
public:
void get_value()
{cout<<"num,name,sex:"<<"\t";
cin>>num>>name>>sex;}
void display()
{cout<<"num"<<"\t"<<"name"<<"\t"<<"sex"<<endl;
cout<<num<<"\t"<<name<<"\t"<<sex<<ednl;
};
class student1:public student
{
private:
int age;
string addr;
public:
void get_value_1()
{cout<<"enter age,addr:"<<endl;
cin>>age>>addr;}
void display_1()
{cout<<"num:"<<"\t"<<"name"<<"\t"<<"sex"<<"\t"<<"age"<<"\t"<<"address"<<endl;
cout<<num<<"\t"<<name<<"\t"<<sex<<"\t"<<age<<"\t"<<addr<<endl;
}
};
int main()
{student1 stud;
stud.get_value();
stud.get_value_1();
stud.display();
stud.display_1();
return 0;
}
错误如下:
Compiling...
c++xiti2.cpp
C:\编程\Visual+C+++6.0(支持win7)\Microsoft Visual Studio\Common\MSDev98\Bin\c++xiti2.cpp(19) : error C2504: 'student' : base class undefined
C:\编程\Visual+C+++6.0(支持win7)\Microsoft Visual Studio\Common\MSDev98\Bin\c++xiti2.cpp(41) : fatal error C1004: unexpected end of file found
执行 cl.exe 时出错.