填空题

[说明]
阅读下面程序,指出其中代码的错误及原因。
[C++程序]
01 #include <iostream.h>
02 class employee
03 private:
04 short age;
05 float salary ;
06 friend void funcl () ;
07 protected:
08 char* name;
09 public:
10 employee (char* nn, short ag, float salr) ;
11 void print () const ;
12 ~employee () ;
13 ;
14 manage:public employee
15 char* department;
16 //...
17 public:
18 void print () ;
19 void setEmployee () ;
20 //...
21
22 //...
23 void manage::print ()
24
25 cout <<"name: " name<<endl;
26 cout<<"salary: "<<salary<<endl; //-- (1)
27
28 void manager::setEmployee(char* dept)
29
30 employee::employee(char* nm,short ag,float salr) ; //-- (2)
//-- (3)
31 department=dept;
32
33 void funcl ()
34
35 cout <<"department:"<<department 11-- (4)
36 <<",name: "<<name<<endl;
37 //...
38
39 void main ()
40
41 employee aemp; //-- (5)
42 manager amngr (" Kng " , 35, 578. 9);
43 //...
44

【参考答案】

一旦定义了构造函数,系统将不再生成默认构造函数
热门 试题

填空题
n%k
填空题
run(data,i,right)
相关试题