vehicle(交通工具)学习课件.pptVIP

  • 25
  • 0
  • 约4.66万字
  • 约 81页
  • 2016-12-10 发布于江苏
  • 举报
Inheritance inheritance a mechanism that build a new class by deriving from an existing class derived class (or subclass) inherit from based class (or superclass) increase code reusability e.g. car(轎車) is a class derived from vehicle(交通工具) graduate_student is a class derived from student cat is a class derived from animal syntax class Derived_class : public Base_class { . . . } Inheritance(example) class Pen { public: enum ink {Off, On}; void set_status(ink); void set_location(int, int); private: int x; int y; ink status; }; class CPen : public Pen { public:

文档评论(0)

1亿VIP精品文档

相关文档