Inheritance is used to describe the relationship between classes. What are the three ways in which this relationship is advantageous?
- Subclasses that inherit from the same superclass include attributes and behaviors from the superclass.
- Changes can be made easily and quickly to a large group of subclasses by making changes to the superclass they inherit from.
- Code can be reused through inheritance, which means we do not need to re-implement behaviors that already exist.
Inheritance and methods exemplify the generalization design principle. There are techniques that left us apply a rule called D.R.Y., which stands for "Don't Repeat Yourself"
Generalization will help you build software that is easier to expand, easier to apply changes to and easier to maintain.
'공부 > Object-Oriented Design' 카테고리의 다른 글
3.2 – Separation of Concerns (0) | 2021.09.21 |
---|---|
3.1 – Coupling and Cohesion (0) | 2021.09.21 |
2.5 – Decomposition (0) | 2021.09.18 |
2.4 – Encapsulation (0) | 2021.09.18 |
2.3 – Abstraction (0) | 2021.09.18 |
댓글