Inheritance is a programming language mechanism that allows us to create objects from definitions provided in multiple, inter-related classes. It is a powerful feature that offers a natural solution to many design problems related to code reuse and extensibility. At the same time, it is a complex mechanism that can all too easily be misused. This chapter provides a review of inheritance and presents the major design rules and patterns involving it.

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Inheritance

  • Martin P. Robillard

摘要

Inheritance is a programming language mechanism that allows us to create objects from definitions provided in multiple, inter-related classes. It is a powerful feature that offers a natural solution to many design problems related to code reuse and extensibility. At the same time, it is a complex mechanism that can all too easily be misused. This chapter provides a review of inheritance and presents the major design rules and patterns involving it.