클래스 형식
class Cal:
def __init__(self): --> 생성자(Constructor), self - 생성되는 객체
self.result = 0
def add(self, num):
self.result += num
return self.result
a = Cal()
b = Cal()
print(a.add(3))
상속(Inheritance)
class Inhe(Cal): --> Cal class를 상속받음
pass
'Sduty > python' 카테고리의 다른 글
PyQt4 --> PyQt5 변경사항 (0) | 2019.04.12 |
---|---|
PyQt5, PyQt5 Designer, PyDeploy 설치 (0) | 2019.04.12 |
파일 읽기,쓰기 (0) | 2019.03.13 |
함수 (0) | 2019.03.13 |
제어문(if, while, for) (0) | 2019.03.12 |