进行一个实验demo
class demo():
def __init__(self):
print("this is a demo")
def dede(self):
self.next = None
te = demo()
print(te)
te2 = demo()
print(te2)
te = te2
print(te)
print(te2)
te.next = 10
print(te2.next)
运行结果及说明
"C:\Users\Lenovo\Desktop\Python coding\venv\Scripts\python.exe" "C:/Users/Lenovo/Desktop/Python coding/testdemo.py"
this is a demo
<__main__.demo object at 0x0000015FD0F5BFD0>
this is a demo
<__main__.demo object at 0x0000015FD0F5BFA0>
<__main__.demo object at 0x0000015FD0F5BFA0>
<__main__.demo object at 0x0000015FD0F5BFA0>
10
Process finished with exit code 0
|