C++课件第8章继承与派生.pptxVIP

  • 2
  • 0
  • 约7.19千字
  • 约 92页
  • 2021-10-08 发布于河南
  • 举报
第8章继承与派生;第8章继承与派生;么NJ8;只要定义淸楚了 “交通工具”,那么在定义“汽车”时;C++提供了类定义的派生和继承功能,能很好;派生类使用例--公司雇员档案的管理 —参看书p251, 8. 1节;I;public:;class manager: public employee ( //派生类 int 1职el_________________________ ____ _____________________ publ ic: manager (short ag, float sa, char* na, int lev) :employee (ag, sa,na)( 〃对基类初始化负责 level=lev; } void print () const ( employee: : print 0 ; 〃调用基类print显示“共性”数;/*注意:允许派生类中的print与基类的print重名,按如下 规定进行处理:对???类而言,不加类名限定时默认为是处理 子类成员,而要访问父类重名成员时,则要通过类名限定*/ class engineerfpublic employee { char speciality,adegree; public:;void main () { //主函数 employee empl (23, 610

文档评论(0)

1亿VIP精品文档

相关文档