error C2838: illegal qualified name in member declaration
#include<iostream.h>#include<string.h>
class Teacher
{
private:
int age;
char name[20],sex[5],address[30],telnum[11],title[10];
public:
void input();
void display();
Teacher();
};
class Gadre
{
private:
char post[10];
};
class Teacher_Gadre:public Teacher,public Gadre
{
private:
int wages;
public:
Teacher_Gadre();
void show();
void input()
{
int a;
char n,s,ad,tel,t;
cout<<"请分别输入教师的名字,性别,年龄,住址,电话,职称:"<<endl;
cin>>n>>s>>a>>ad>>tel>>t;
age=a;
strcpy(name,n);
strcpy(sex,s);
strcpy(address,ad);
strcpy(telnum,tel);
strcpy(title,t);
}
void Teacher::display()
{
cout<<"请输出教师的信息:"<<endl;
cout<<name<<age<<sex<<address<<telnum<<title<<endl;
}
Gadre::Gadre(char p)
{
cout<<"请输入教师干部的干部的职务:"<<endl;
cin>>p;
strcpy(post,p);
}
void Teacher_Gadre::show()
{
int w;
wages=w;
cout<<<"请输入教师干部的工资:"<<endl;
cin>>w;
Teacher::display();
cout<<"教师的职务:"<<post<<endl;
cout<<"教师的工资:"<<wages<<endl;int main
}
int main()
{
Teacher t1;
Gadre g1;
Teacher_Gadre tg1;
t1.display();
cout<<t1.name<<t1.<age<<<t1.sex<<<t1.address<<<t1.telnum<<<t1.title<<<g1.post<<endl;
tg1.show();
return 0;
}
error C2838: illegal qualified name in member declaration
F:\实验代码\8-2.cpp(40) : error C2143: syntax error : missing ';' before '<<'
F:\实验代码\8-2.cpp(40) : error C2501: 'cout' : missing storage-class or type specifiers
F:\实验代码\8-2.cpp(40) : error C2059: syntax error : '<<'
F:\实验代码\8-2.cpp(40) : error C2238: unexpected token(s) preceding ';'
F:\实验代码\8-2.cpp(41) : error C2143: syntax error : missing ';' before '<<'
F:\实验代码\8-2.cpp(41) : error C2501: 'cout' : missing storage-class or type specifiers
F:\实验代码\8-2.cpp(41) : error C2059: syntax error : '<<'
F:\实验代码\8-2.cpp(41) : error C2238: unexpected token(s) preceding ';'
F:\实验代码\8-2.cpp(44) : error C2533: 'Gadre::Gadre' : constructors not allowed a return type
F:\实验代码\8-2.cpp(44) : error C2511: 'Gadre::Gadre' : overloaded member function 'void (char)' not found in 'Gadre'
F:\实验代码\8-2.cpp(14) : see declaration of 'Gadre'
F:\实验代码\8-2.cpp(48) : fatal error C1903: unable to recover from previous error(s); stopping compilation
执行 cl.exe 时出错.
各路大神,求帮助