-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp06_class_init.py
More file actions
36 lines (27 loc) · 1005 Bytes
/
Copy pathp06_class_init.py
File metadata and controls
36 lines (27 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
class Father: # 괄호없으면 상속받을게 없다는 것
def __init__(self, name1):
self.name = name1
print("Father __init__ 실행됨")
print(self.name, "발롱도르")
babo = 4
aaa = Father('김치싸대기')
print('----------------------------------------------------------------------')
class Son(Father): # Father를 상속받을거야
def __init__(self, name):
print("Son __init__ 시작")
super().__init__(name)
print("Son __init__ 끝")
cheonje = 5
bbb = Son('흥민쏘오오오니')
class Tomato:
def __init__(self, name):
self.name = name
print("Tomato __init__ 실행됨")
print(self.name, "토마토")
ccc = Tomato('토마토')
class Builder(Tomato, Father):
def __init__(self, name):
print('Builder __init__ initiate')
super().__init__(name)
print('Builder __init__ done')
ddd = Builder('머쨍이')