Public/Protected/Private Inheritance
Public Inheritance
Protected Inheritance
Private Inheritance
- 부모의 속성을 그대로 물려 받는다. public --> public, protected --> protected
Protected Inheritance
- 부모의 속성이 protected가 된다. public --> protected, protected --> protected
Private Inheritance
- Java에는 없는, C++에는 있는 상속의 방법으로 부모의 public, protected 영역이 자식의 private이 되는 상속이다.
- List <-- Stack, TV <-- RemoteCon 과 같이 부모의 기능을 이용하여 자식의 기능을 구현하는 관계(부모의 모든 속성을 다 물려 받을 필요가 없는)에서 사용된다.
- http://2uropa.tistory.com/entry/public-%EC%83%81%EC%86%8D%EA%B3%BC-private-%EC%83%81%EC%86%8D%EC%97%90-%EB%8C%80%ED%95%B4
https://stackoverflow.com/questions/860339/difference-between-private-public-and-protected-inheritance
0개의 덧글:
댓글 쓰기
에 가입 댓글 [Atom]
<< 홈