1 / 11
文档名称:

实验三多态性实验报告计划.docx

格式:docx   大小:20KB   页数:11页
下载后只包含 1 个 DOCX 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

实验三多态性实验报告计划.docx

上传人:爱的奉献 2022/3/7 文件大小:20 KB

下载得到文件列表

实验三多态性实验报告计划.docx

相关文档

文档介绍

文档介绍:精品文档
精品文档
1
精品文档
浙江理工大学信息学院
实验指导书
实验名称:类的多态性的实现

学时安排:

3
精品文档
精品文档
11
精品文档
实验类别:设计性实验

实验要求:acestd;
classEmployee
精品文档
精品文档
7
精品文档
{
protected:
stringname;
stringID;
stringsex;
stringjob;
CDatedate;
doublebasicmoney;
public:
Employee(stringID,stringname,stringsex,CDatedate,stringjob,doublebasicmoney);
stringgetjob(){returnjob;}
stringgetname(){returnname;}
stringgetID(){returnID;}
stringgetsex(){returnsex;}
doublegetbasicmoney(){returnbasicmoney;}
CDategetdate(){returndate;}
virtualdoublegetpay(intm)=0;
};
classReport
{
private:
list<Employee*>members;
list<Employee*>operator[](stringjob);
doublemin_pay(list<Employee*>emp_list,intmonth);doublemax_pay(list<Employee*>emp_list,intmonth);voidprint(list<Employee*>emp_list,intmonth);
public:
~Report();
精品文档
精品文档
8
精品文档
voidinsert(Employee*p);
voidprint(intn);
};
classManager:publicEmployee
{
private:
map<int,int>price;
public:
精品文档
精品文档
9
精品文档
Manager(stringjob,double

ID,string

name,string

sex,CDatedate,stringbasicmoney,map<int,int>
精品文档
精品文档
11
精品文档
price):Employee(ID,name,sex,date,job,basicmoney)
{this->price=price;}
doublegetpay(intm);
};
classTechnicist:publicEmployee
{
public:
Technicist(stringID,stringname,stringsex,CDatedate,stringjob,doublebasicmoney):Employee(ID,name,sex,date,job,basicmoney){}
doublegetpay(intm);
};
classSalesPerson:publicEmployee
{
private:
map<int,int>sales;
public:
精品文档
精品文档
11
精品文档
SalesPerson(stringjob,double

ID,string

name,string

sex,CDatedate,stringbasicmoney,map<int,int>
精品文档
精品文档
11
精品文档
sales):Employee(ID,name,sex,date,job,basicmoney)
精品文档
精品文档
11
精品文档
{this->sales=sales;}doublegetpay(intm);
};
#endif
//
#include""
#include<iostream>
#include<algorithm>
usingnamespacestd;
Employee::Employee(stringID,stringname,stringsex,CDatedate,string
job,doublebasicmoney)
{
this->ID=ID;
this->name=name;
this->sex=sex;
this->date=date;
this->basicmoney=basicmoney;
this->j