官术网_书友最值得收藏!

Chapter 3. When Objects Are Alike

In the programming world, duplicate code is considered evil. We should not have multiple copies of the same, or similar, code in different places.

There are many ways to merge pieces of code or objects that have a similar functionality. In this chapter, we'll be covering the most famous object-oriented principle: inheritance. As discussed in Chapter 1, Object-oriented Design, inheritance allows us to create is a relationships between two or more classes, abstracting common logic into superclasses and managing specific details in the subclass. In particular, we'll be covering the Python syntax and principles for:

  • Basic inheritance
  • Inheriting from built-ins
  • Multiple inheritance
  • Polymorphism and duck typing
主站蜘蛛池模板: 土默特右旗| 体育| 游戏| 乌兰浩特市| 公主岭市| 南皮县| 安平县| 越西县| 西平县| 北京市| 深泽县| 页游| 凌云县| 永兴县| 邵武市| 漾濞| 江安县| 栖霞市| 民乐县| 林州市| 工布江达县| 晋江市| 宽城| 潜江市| 陇南市| 安丘市| 射洪县| 涞水县| 封丘县| 稻城县| 青铜峡市| 策勒县| 谢通门县| 广河县| 澄江县| 墨脱县| 五指山市| 阜平县| 西安市| 西平县| 镇巴县|