객체 지향 프로그래밍 (OOP)

객체 중심의 프로그래밍 기법.

객체 지향 프로그래밍(OOP)은 데이터(속성)와 코드(메서드)를 포함하는 자체 완결적 '객체'를 중심으로 코드를 구조화하는 패러다임입니다.

OOP의 4가지 기둥:
1. 캡슐화: 데이터와 메서드 묶기, 내부 상태 숨기기
2. 추상화: 필수 기능만 노출
3. 상속: 클래스가 부모 클래스로부터 속성/메서드 상속
4. 다형성: 같은 인터페이스, 다른 구현

        graph LR
  Center["객체 지향 프로그래밍 (OOP)"]:::main
  Rel_functional_programming["functional-programming"]:::related -.-> Center
  click Rel_functional_programming "/terms/functional-programming"
  Rel_java["java"]:::related -.-> Center
  click Rel_java "/terms/java"
  Rel_stored_program_concept["stored-program-concept"]:::related -.-> Center
  click Rel_stored_program_concept "/terms/stored-program-concept"
  classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
  classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
  classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
  classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
  linkStyle default stroke:#4b5563,stroke-width:2px;

      

🧠 지식 테스트

1 / 1

🧒 5살도 이해할 수 있게 설명

레고 설명서를 생각해 보세요. 클래스는 집을 짓는 설명서와 같습니다. 그 설명서를 따라 짓는 각 집은 객체입니다. 다른 집들은 부품을 공유할 수 있지만(상속) 다르게 보일 수 있습니다(다형성)!

🤓 Expert Deep Dive

SOLID 원칙은 좋은 OOP 설계를 안내합니다. 상속보다 합성은 취약한 기반 클래스 문제를 피합니다. 덕 타이핑(Python)은 상속 없이 다형성을 가능하게 합니다.

📚 출처