Taban ve Türemiş
This commit is contained in:
parent
7280eead01
commit
12bf1e6adf
1 changed files with 20 additions and 0 deletions
20
python-temel/taban_ve_turemis.py
Normal file
20
python-temel/taban_ve_turemis.py
Normal file
|
@ -0,0 +1,20 @@
|
|||
class A:
|
||||
def __init__(self):
|
||||
print('A __init__ called: {}'.format(type(self)))
|
||||
self.x = 10
|
||||
|
||||
def dispA(self):
|
||||
print('A.Disp: {}'.format(self.x))
|
||||
|
||||
class B(A):
|
||||
def __init__(self):
|
||||
print('B __init__ called: {}'.format(type(self)))
|
||||
super(B, self).__init__()
|
||||
self.x = 20
|
||||
|
||||
def dispB(self):
|
||||
print('B.Disp: {}'.format(self.x))
|
||||
|
||||
b = B()
|
||||
b.dispB()
|
||||
b.dispA()
|
Loading…
Reference in a new issue