資源簡介
C++實戰源碼-員工間的差異(入門級實例211).zip
代碼片段和文件信息
//?Differ.cpp?:?Defines?the?entry?point?for?the?console?application.
//
#include?“stdafx.h“
#include?“string.h“
#include?“iostream.h“
typedef?char?String[30];
class?Employee?{
private:?
String?m_name; //員工的姓名
????double?m_salary; //員工的工資
????String?m_birthday; //員工的生日
public:
char?*?getName()?{//獲得員工的姓名
????????return?m_name;
????}
????void?setName(String?name)?{//設置員工的姓名
strcpy(m_namename);
????}
????double?getSalary()?{//獲得員工的工資
????????return?m_salary;
????}
????void?setSalary(double?salary)?{//設置員工的工資
m_salary?=?salary;
????}
????char?*?getBirthday()?{//獲得員工的出生日期
????????return?m_birthday;
????}
????void?setBirthday(String?birthday)?{//設置員工的出生日期
strcpy(m_birthdaybirthday);
????}
};
class?Manager?:?public?Employee?{
private:
double?m_bonus;//經理的獎金
public:
double?getBonus()?{//獲得經理的獎金
????????return?m_bonus;
????}
????void?setBonus(double?bonus)?{//設置經理的獎金
????????m_bonus?=?bonus;
????}
};
int?main(int?argc?char*?arg
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????1848??2010-10-14?09:49??Differ\Differ.cpp
?????文件????????4536??2010-10-14?09:07??Differ\Differ.dsp
?????文件?????????537??2010-10-14?09:07??Differ\Differ.dsw
?????文件?????????293??2010-10-14?09:07??Differ\StdAfx.cpp
?????文件?????????769??2010-10-14?09:07??Differ\StdAfx.h
- 上一篇:C++實戰源碼-重寫父類中的方法
- 下一篇:C++實戰源碼-結構體變量的初始化
評論
共有 條評論