만약 자동차가 객체라면 그 데이터에는 제조사, 모델, 도어 숫자, 차량번호 등이 있을 겁니다.
그리고 그 기능으로는 가속, 변속, 문 열기, 헤드라이트 켜기 등이 있을 겁니다. 또한,
OOP
는
사물에 관해 추상적으로(
어떤
자동차), 구체적으로(
특정
자동차) 생각할 수 있게 합니다.
본격적으로 시작하기 전에
OOP
의 기본 용어에 대해 알아봅시다.
클래스
는
어떤
자동차처럼
추상적이고 범용적인 것입니다.
인스턴스
는
특정
자동차처럼 구체적이고 한정적인 것입니다.
기능은
메서드
라고 부릅니다. 클래스에 속하지만 특정 인스턴스에 묶이지는 않는 기능을
클래
스 메서드
라고 합니다. 예를 들어 ‘시동을 거는’ 기능은 클래스 메서드라 할 수 있습니다. 인스턴
스를 처음 만들 때는
생성자
constructor
가 실행됩니다. 생성자는 객체 인스턴스를 초기화합니다.
OOP
는 클래스를 계층적으로 분류하는 수단도 제공합니다. 예를 들어 자동차보다 더 범용적
인
운송 수단
vehicle
클래스가 있다고 합시다. 운송 수단 클래스에는 자동차와 마찬가지로 급유
나 충전 없이 이동할 수 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.
O’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
I wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
I’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
I'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.