Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added _raw/language-diamond.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 33 additions & 1 deletion contents/language.md
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,46 @@ public class SamsungSmartRemocon implements Remocon {
}
```

<br />
</details>

----------------------------------------

<br />
<br />

----------------------------------------

### Java에서 다중상속을 지원하지 않는 이유는 무엇인가요.

<details>
<summary>예비 답안 보기 (👈 Click)</summary>
<br />

<p align="center">
<img src="../_raw/language-diamond.png" />
</p>

- C++에서는 한 클래스에서 직간접적으로 하나 이상의 클래스를 상속할 수 있으며 이를 __다중상속__ 이라 한다.
- 그러나 두 부모 클래스(House, Office)가 한 클래스로(Place)부터 파생된 클래스인 경우 다중상속을 쓰면 애매한 상황이 발생한다.
1. 상속받은 House, Office 클래스에 같은 이름의 멤버가 존재할 가능성
2. 하나의 클래스(Place)를 간접적으로 두 번 이상 상속받을 가능성이 있습니다.
3. 가상 클래스가 아닌 기초 클래스를 다중 상속하면, 기초 클래스 타입의 포인터로 파생 클래스를 가리킬 수 없음

<br />

이러한 문제를 죽음의 다이아몬드(the Deadly Diamond of Death), 다이아몬드 문제(diamond problem)라고 한다. 다아아몬드 문제를 막기 위해서 다중상속을 막는다.

<br />
</details>

----------------------------------------

<br />
<br />

----------------------------------------

### 쓰레드세이프란?

```
Expand Down Expand Up @@ -562,4 +594,4 @@ public class SamsungSmartRemocon implements Remocon {
<h3> 용감한 친구들 with 남송리 삼번지 </h3>
<hr />
</div>


2 changes: 2 additions & 0 deletions contents/source.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
- [Trello/ 면접준비](https://trello.com/b/MugMXwGi/%EB%A9%B4%EC%A0%91%EC%A4%80%EB%B9%84%F0%9F%91%91)
- [ksundong / backend-interview-question](https://github.com/ksundong/backend-interview-question)
- [Kirchhoff-/ Android-Interview-Questions](https://github.com/Kirchhoff-/Android-Interview-Questions)
- [boostcamp-ai-tech-4 / ai-tech-interview](https://github.com/boostcamp-ai-tech-4/ai-tech-interview)
- [web-development-encyclopedia](https://github.com/parker1609/web-development-encyclopedia)
- [Back-end-Developer-Interview-Questions](https://github.com/NESOY/Back-end-Developer-Interview-Questions)
- [jwasham / coding-interview-university](https://github.com/jwasham/coding-interview-university)
- [ClintJang / ios-swift-objc-questions-and-answers](https://github.com/ClintJang/ios-swift-objc-questions-and-answers)


<br />

### 일반 질문
Expand Down