c++说我有两个无法解析的外部命令

c++说我有两个无法解析的外部命令char*m_pName;floatm_fSalary;intm_nAge;public:charname;intage;floatsa... c++说我有两个无法解析的外部命令char *m_pName; float m_fSalary; int m_nAge;public: char name; int age; float salary; CEmployee(char*name = NULL, int age = 0, float salary = 0.0); CEmployee(const CEmployee&); ~CEmployee(); void SetName(char*) { cout << "姓名" <<name <<endl; } char* GetName() { name = *m_pName; } void SetAge(int) { cout << "年龄" << age << endl; } int GetAge() { age = m_nAge; } void SetSalary(float) { cout << "工资" << salary << endl; } float GetSalary() { salary = m_fSalary; } void print() { void SetName(char*); void SetAge(int); void SetSalary(float); }};class CManager : public CEmployee{private: int m_nLevel;public: int level; CManager(char *name = NULL, int age = 0, float salary = 0.0, int level = 0) :CEmployee(name, age, salary) { level = m_nLevel; } CManager(const CEmployee &); ~CManager(); void SetLevel(int) { cout << "等级:" << level << endl; } int GetLevel() { level = m_nLevel; } void print1() { CEmployee::print(); void SetLevel(int); }};int main(){ CManager employee1("张三", 26, 3000); employee1.print1(); CManager manager1("李四",40,5000,1); manager1.print1(); return 0;} 展开
 我来答
microroom
科技发烧友

2017-05-29 · 智能家居/数码/手机/智能家电产品都懂点
知道大有可为答主
回答量:7118
采纳率:83%
帮助的人:1604万
展开全部
#include<iostream>
#include<iomanip>
#include<cstdlib>
using namespace std;
class CEmployee
{
public:
CEmployee(string n="",int a=0,float s=0.0):name(n),age(a),salary(s)
{

}
CEmployee(const CEmployee &r)
{
name=r.name;
age=r.age;
salary=r.salary;
}
virtual ~CEmployee()
{

}
void SetName(string str)
{
cout<<"名租没闹字"<<str<<endl;
name=str;
}
string GetName()
{
return name;
}
void SetAge(int n)
{
cout<<"年龄"<<n<<endl;
age=n;
}
int GetAge()
{
return age;
}
void SetSalary(float s)
{
cout<<"工资"<<s<<endl;
salary=s;
}
float GetSalary()
{
return salary;
}
void Print()
{
cout<<"名字"<<name<<endl;
cout<<"年龄"<<age<<endl;
cout<<"工资"<<salary<<endl;
}
private:
string name;
int age;
float salary;
};
class CManager : public CEmployee
{
public:
CManager(string n="",int a=0,float s=0.0,int l=0):CEmployee(n,a,s)
{
level=l;
}
CManager(const CManager &r)
{
level=r.level;
}
virtual ~CManager()
{

}
void SetLevel(int l)
{
cout<<"等级察链:"<<l<<弊罩endl;
level=l;
}
int GetLevel()
{
return level;
}
void Print()
{
CEmployee::Print();
cout<<"等级:"<<level<<endl;
}
private:
int level;
};
int main()
{
CEmployee employee1(string("张三"), 26, 3000);
employee1.Print();
cout<<endl;
CManager manager1(string("李四"),40,5000,1);
manager1.Print();
system("PAUSE");
return EXIT_SUCCESS;
}
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式