class person:
def __init__(self,name):
self.name=name
@property
def name(self):
return self.__name
@name.setter
def name(self,value1):
self.__name=value1
class place:
def __init__(self,position):
self.position=position
@property
def position(self):
return self.__position
@position.setter
def position(self,value2):
self.__position=value2
class work:
def __init__(self,behavior):
self.__behavior=behavior
@property
def behavior(self):
return self.__behavior
@behavior.setter
def behavior(self,value3):
self.__behavior=value3
def go_to(self,name,position,behavior):
print(name.name,'去',position.position,behavior.behavior)
ly=person('小明')
school=place('学校')
reading=work('读书')
reading.go_to(ly,school,reading)
|