Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[산하] 13장 정리 #42

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

[산하] 13장 정리 #42

wants to merge 1 commit into from

Conversation

headF1rst
Copy link
Contributor

No description provided.


상속 관계로 연결한 두 클래스가 서브타이핑 관계를 만족시키며 서브타입은 그것의 기반 타입에 대해 대체 가능해야 한다.

### 리스코프 치환 원칙을 위반하는 is-a 관계 (정사각형, 직사각형)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리스코프 치환원칙은 SOLID를 설명하면서 매번 어물쩡 넘아가곤 했었는데 이번 예시로 설명하면 좋겠네요 👍🏼

- 하지만 `Square` 는 너비와 높이가 항상 같다.
- Ractangle을 Square로 대체할 경우 Rectangle에 세워진 가정을 위반할 확률이 높다.

- is-a 관계의 문장 앞에 `"클라이언트 입장에서"`라는 말이 빠져 있다고 생각하라.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

상속 관계를 결정지을 때 중요하게 고려해야 하는 요소네요!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants