From 221daa9bb2c59afa15f3f44fd90aa645e6d3f55e Mon Sep 17 00:00:00 2001 From: Jimp <57986506+ReJimp@users.noreply.github.com> Date: Sat, 11 Dec 2021 13:47:34 +0800 Subject: [PATCH] =?UTF-8?q?Update=20=E7=BC=96=E7=A8=8B=E5=AE=9E=E4=BE=8B.c?= =?UTF-8?q?pp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../10_day_practice/day6/虚函数/编程实例.cpp | 128 +++++++++--------- 1 file changed, 64 insertions(+), 64 deletions(-) diff --git a/practical_exercises/10_day_practice/day6/虚函数/编程实例.cpp b/practical_exercises/10_day_practice/day6/虚函数/编程实例.cpp index 4e6be99..6893683 100644 --- a/practical_exercises/10_day_practice/day6/虚函数/编程实例.cpp +++ b/practical_exercises/10_day_practice/day6/虚函数/编程实例.cpp @@ -1,92 +1,92 @@ /* -ij˾оԱСʱȶԱܼнԱÿµн800Ԫ -Ȼɣÿ1Ʒȡ5%СʱСʱнÿԱ֤ŵݡ -Ϊ⣬ѸԱĹϢɻEmployeeԱ̳иĹܡ +某公司有经理、销售员、小时工等多类人员。经理按周计算薪金;销售员每月底薪800元, +然后加销售提成,每销售1件产品提取销售利润的5%;小时工按小时计算薪金。每类人员都有姓名和身份证号等数据。 +为简化问题,把各类人员的共有信息抽象成基类Employee,其他人员则继承该类的功能。 */ #include #include using namespace std; class Employee{ - public: - Employee(string Name ,string id){ name=Name; Id=id; } - string getName(){ return name; } // - string getID(){ return Id; } //֤ - float getSalary(){ return 0.0; } //нˮ - void print(){ //֤ - cout<<": "<>week; - Manager m("С","11111111",week); + Manager m("小王","11111111",week); m.print(); - cout<<""; + cout<<"请输入销售利润:"; int profit; cin>>profit; - cout<<"ۼ"; + cout<<"请输入销售件数:"; int x; cin>>x; - SaleWorker s("С","222222",profit,x); + SaleWorker s("小李","222222",profit,x); s.print(); - cout<<"빤Сʱ"; + cout<<"请输入工作小时:"; int hour; cin>>hour; - HourWorker h("С","333333",hour); + HourWorker h("小何","333333",hour); h.print(); system("pause"); return 0; -} \ No newline at end of file +}