c++程序 员工类的问题 急!!!

发布网友

我来回答

1个回答

热心网友

人类
class People
{
public:
People();
virtual ~People();
CString GetName() { return name; };//得到名字
CString sex;//性别
CString name;//名字
};

员工类:
class employee : public People
{
public:
int ComparID(int ID1,int ID2);
int ID;
CString dept;
employee();
virtual ~employee();

};

employee::employee()
{
ID=2008;//定义时 将ID自动赋值2008
}

employee::~employee()
{

}
//返回值 1:ID1>ID2; 0 :ID1=ID2 ; -1 ID1<ID2 ; -2 : Error
int employee::ComparID(int ID1, int ID2)
{
int rtn = -2;
if(ID1>ID2)
rtn= 1;
if(ID1<ID2)
rtn=1;
if(ID1==ID2)
rtn =0;
return rtn;
}

这样能满足你的要求吗?

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com