| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1945 人关注过本帖
标题:error C2838: illegal qualified name in member declaration
只看楼主 加入收藏
yongfei1
Rank: 1
来 自:长春
等 级:新手上路
帖 子:1
专家分:0
注 册:2018-5-19
收藏
 问题点数:0 回复次数:0 
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 时出错.

各路大神,求帮助
搜索更多相关主题的帖子: name cout 实验 代码 cpp 
2018-05-19 18:06
快速回复:error C2838: illegal qualified name in member declaration
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.027856 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved