class worker{public:worker(string dep,string nam,int n,int x);//定義構(gòu)造函數(shù)worker(){}void set(int &);int choiceoption();void displayall(int m);int yanzheng(int ,int );//驗(yàn)證員工號(hào)string department;string name;int num;int situ1[13];int situ2[13];int situ3[13];int situ4[13];int situ5[13];int situ6[13];int situ7[13];};class KQdk:virtual public worker{public:void show1();//顯示菜單函數(shù)KQdk(string dep,string nam,int n,int x):worker(dep,nam,n,x){}void run1(worker a,int choice,int m);//choice<=2void run2(worker &,int m);//choice=3void GLYZ(int &);void tim (const struct tm *&);//計(jì)算值(時(shí)間函數(shù))};class KQTJ:virtual public worker{public:void month_tongji(worker a,int m);KQTJ(string dep,string nam,int n,int x):worker(dep,nam,n,x){}void year_tongji(worker a);void display_KQ(worker a,int m,int &,int &,int& );//m為月份;q,w,e分別為全勤,曠工》2,遲到或早退》5的標(biāo)志void KQTJ_display();};class menu:public KQdk,public KQTJ{public:menu(string dep,string nam,int n,int x):KQdk(dep,nam,n,x),KQTJ(dep,nam,n,x){}//構(gòu)造函數(shù)void pasue();void menu_welcome();//歡迎界面void menu_start();//菜單顯示界面void menu_end();//退出界面void menu_run();//運(yùn)行函數(shù)int menu_display(worker (&a)[11],int);};這是我的4個(gè)類。。。在定義worker staff[11]={worker("wewe","wewe",45)worker('a','a',1),worker('a','b',2),worker('a','c',3),worker('a','d',4),worker('a','e',5),worker('b','f',6),worker('b','g',7),worker('b','h',8),worker('b','i',9),worker('b','j',10)};
2 回答

蕭十郎
TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超13個(gè)贊
worker(string dep,string nam,int n,int x);//定義構(gòu)造函數(shù)
這是你的構(gòu)造函數(shù),它接收4個(gè)參數(shù),分別是 string string int int,你如果只傳遞3個(gè)參數(shù),要么使用默認(rèn)參數(shù),要么再定義相應(yīng)版本的構(gòu)造函數(shù)。
另外 string 類沒有構(gòu)造函數(shù)接收 char ,但可以接收字符串(const char *),所以你可以傳遞參數(shù) "a" ,但不可以傳遞 'a'。
數(shù)組可以這么定義,這時(shí)數(shù)組大小可以由編譯器計(jì)算,如無必要,不必手工填寫

ITMISS
TA貢獻(xiàn)1871條經(jīng)驗(yàn) 獲得超8個(gè)贊
你定義的是4個(gè)參數(shù)的構(gòu)造函數(shù),
worker('a','b',2),只傳了3個(gè)實(shí)參
- 2 回答
- 0 關(guān)注
- 181 瀏覽
添加回答
舉報(bào)
0/150
提交
取消