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

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 similar pieces of code or objects with similar functionality. In this chapter, we'll be covering the most famous object-oriented principle: inheritance. As discussed in Chapter 1, inheritance allows us to create "is a" relationships between two or more classes, abstracting common details into superclasses and storing specific ones 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
主站蜘蛛池模板: 新邵县| 仪陇县| 鄂州市| 杭州市| 大庆市| 获嘉县| 商水县| 全椒县| 明溪县| 进贤县| 开封市| 大丰市| 临城县| 青海省| 凤翔县| 许昌市| 环江| 子洲县| 农安县| 同德县| 遂宁市| 阳原县| 通渭县| 玛沁县| 黎川县| 宁国市| 宜良县| 若羌县| 托克托县| 凭祥市| 台安县| 吉安市| 淮北市| 梁平县| 哈密市| 东乡族自治县| 岐山县| 行唐县| 宾川县| 阿拉尔市| 南陵县|