del method example 2
This commit is contained in:
parent
aad6127d7e
commit
6a0009cbf5
19
python-temel/del.method.2.py
Normal file
19
python-temel/del.method.2.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
class A:
|
||||
def __init__(self):
|
||||
print('A.__init__ called')
|
||||
|
||||
def __del__(self):
|
||||
print('A.__del__ called')
|
||||
|
||||
class B(A):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
print('B.__init__ called')
|
||||
|
||||
def __del__(self):
|
||||
print('B.__del__ called')
|
||||
super().__del__()
|
||||
|
||||
b = B()
|
||||
b = None
|
||||
|
12
python-temel/del.method.2.py~
Normal file
12
python-temel/del.method.2.py~
Normal file
|
@ -0,0 +1,12 @@
|
|||
class A:
|
||||
def __init__(self):
|
||||
print('A.__init__called')
|
||||
|
||||
def __del__(self):
|
||||
print('A.__del__called')
|
||||
|
||||
class B(A):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
print('B.__init__called')
|
||||
|
Loading…
Reference in New Issue
Block a user