del method example

This commit is contained in:
Mert Gör 🇹🇷 2023-07-26 13:06:37 +03:00
parent f24438f86d
commit aad6127d7e
No known key found for this signature in database
GPG key ID: 2100A876D55B39B9

View file

@ -0,0 +1,13 @@
class Sample:
def __del__(self):
print('Nesne yok edilecek!')
s = Sample()
print('Referans sayacı 1')
k = s
print('Referans sayacı 2')
k = None
print('Referans sayacı 1')
s = None
print('Referans sayacı 0')