mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
fd4fb54dc7
update date
21 lines
323 B
Python
21 lines
323 B
Python
class Dog:
|
|
def __init__(self, name) -> None:
|
|
self.name = name
|
|
|
|
def eat(self):
|
|
print('self id = ', id(self))
|
|
print('%s eat...' % (self.name))
|
|
|
|
dog = Dog('dog1')
|
|
print('dog1 id = ', id(dog))
|
|
dog.eat()
|
|
|
|
|
|
def test():
|
|
dog = Dog('dog2')
|
|
print('dog2 id = ', id(dog))
|
|
dog.eat()
|
|
|
|
|
|
test()
|