python 클래스 생성자
4
김김김 김김김 김김김 & 김김김
-
Upload
gyu-hyeon-kim -
Category
Education
-
view
391 -
download
0
Transcript of python 클래스 생성자
![Page 1: python 클래스 생성자](https://reader035.fdocuments.net/reader035/viewer/2022062316/589e5b561a28ab16348b5757/html5/thumbnails/1.jpg)
김규현
클래스 생성자 & 소멸자
![Page 2: python 클래스 생성자](https://reader035.fdocuments.net/reader035/viewer/2022062316/589e5b561a28ab16348b5757/html5/thumbnails/2.jpg)
클래스 __init__
객체를 생성할 때 호출되는 함수 객체 생성 시 초기화 작업을 위해 존재 변수 값을 세팅하는 작업도 포함Tip) 생성자를 사용 하는 이유
: 초기값을 반드시 정해주어야 하는 경우
생성자
Self : 객체 자신 클래스 ( 객체 ) 를 가리킴 ,JAVA 의 this 와 비슷함
![Page 3: python 클래스 생성자](https://reader035.fdocuments.net/reader035/viewer/2022062316/589e5b561a28ab16348b5757/html5/thumbnails/3.jpg)
클래스 __del__
객체를 소멸시켜야할 때 호출하는 함수TIP ) 프로그램 종료 시 생성된 개체는 자동으로 소멸
소멸자
![Page 4: python 클래스 생성자](https://reader035.fdocuments.net/reader035/viewer/2022062316/589e5b561a28ab16348b5757/html5/thumbnails/4.jpg)
~ F I N ~