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;}
展开
展开全部
#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;
}
#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;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询