标题:大神们这个究竟错在了哪里
只看楼主
白叶
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2019-5-24
结帖率:0
已结贴  问题点数:20 回复次数:1 
大神们这个究竟错在了哪里
#include<iostream>
#include<string.h>
using namespace std;

class Enpoyee{
    protected:
        char num[8];
        char name[8];
        int basicSalary;
        int prize;
    public:
        Enpoyee(char a[],char b[],int c,int d):basicSalary(c),prize(d){
            strcpy(num,a);
            strcpy(name,b);
        }
        void show(){
            cout<<"编号"<<num <<"姓名"<< name <<"基本工资"<< basicSalary <<"奖金"<< prize<<endl;
        }
        void showsalary(){
            cout<<"员工实发工资"<<basicSalary+prize<<endl;
        }
};

class Saleman:virtual public Enpoyee{
    protected:
        float deductRate;
        int personAmount;
    public:
         Salema(char a[],char b[],int c,int d,float e,int f):Enpoyee(a,b,c,d),deductRate(e),personAmount(f){//错在这里
         }
        void show2(){
            Enpoyee::show();
            cout<<"销售员提成比例"<<deductRate <<"个人销售额"<<personAmount<<endl;
        }
        void showsalary2(){
            cout<<"销售员实发工资"<<basicSalary+prize+(deductRate*personAmount)<<endl;   
        }            
};


int main(void){
    Enpoyee a("007","小红",10000,1000);
    a.show();
    a.showsalary();
   
    Saleman b("007","小红",10000,1000,0.5,2000);
    b.show2();
    b.showsalary2();
   


}


搜索更多相关主题的帖子: char num int void cout 
2019-05-24 19:26
Jonny0201
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:52
帖 子:488
专家分:2603
注 册:2016-11-7
得分:20 
你的类名是 Saleman
你的构造函数名字是 Salema
另外, 建议把 char [] 换成 const char *
2019-05-25 11:39



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-494929-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.110200 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved