'''
析构函数:__del__() 释放对象时自动调用




'''
class Person(object):
def run(self):
print("run")
def eat(self,food):
print("eat"+food)
def __init__(self,name,age,height,weight):
self.name = name
self.height = height
self.age =age
self.weight = weight
def __del__(self):
print("这里是析构函数")

per = Person("hanmeimie ",20,180,80)

# del per

#对象释放以后就不能在访问了
# print(per.age) #NameError: name 'per' is not defined

#在函数里定义的对象会在函数结束时自动释放,
# 这样可以用来减少内存空间的浪费
def func():
per2 = Person("aa",2,2,2)
func()


#
# while 1 :
# pass