Python Design Principles
Links: 108 Python Index
Prefer Composition over Inheritance¶
- Inheritance: hierarchy of classes and subclasses.
- Composition: separating out the different aspects of what a class consists of and the combining them later.
- It is like using different classes inside a class.
- Example:
References¶
Last updated: 2022-12-25