- 博客(0)
- 资源 (1)
- 收藏
- 关注
深入浅出MFC
深入浅出MFC#0013 //---------------------------------------------------------------
#0014 class CWage : public CEmployee // 时薪职员是一种职员
#0015 {
#0016 private :
#0017 float m_wage;
#0018 float m_hours;
#0019
#0020 public :
#0021 CWage(const char* nm) : CEmployee(nm) { m_wage = 250.0; m_hours = 40.0; }
#0022 void setWage(float wg) { m_wage = wg; }
#0023 void setHours(float hrs) { m_hours = hrs; }
#0024 float computePay();
#0025 };
#0026 //---------------------------------------------------------------
#0027 class CSales : public CWage // 销售员是一种时薪职员
#0028 {
#0029 private :
#0030 float m_comm;
#0031 float m_sale;
#0032
#0033 public :
#0034 CSales(const char* nm) : CWage(nm) { m_comm = m_sale = 0.0; }
#0035 void setCommission(float comm) { m_comm = comm; }
#0036 void setSales(float sale) { m_sale = sale; }
#0037 float computePay();
#0038 };
#0039 //---------------------------------------------------------------
#0040 class CManager : public CEmployee // 经理也是一种职员
#0041 {
#0042 private :
#0043 float m_salary;
#0044 public :
#0045 CManager(const char* nm) : CEmployee(nm) { m_salary = 15000.0; }
#0046 void setSalary(float salary) { m_salary = salary; }
#0047 float computePay();
#0048 };
#0049 //---------------------------------------------------------------
#0050 void main()
#0051 {
#0052 CManager aManager("陈美静");
#0053 CSales aSales("侯俊杰");
#0054 CWage aWager("曾铭源");
#0055 }
#0056 //---------------------------------------------------------------
#0057 // 虽然各类別的 computePay 函数都没有定义,但因为程序也没有调用之,所以无妨。
2012-03-24
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人