class per_info(object):
def init(self, name, age, gender):
self.__name = name
self.__age = age
self.__gender = gender
# the three parameters are private parameters
# only can be get in inner
# can’t be get on outer
def show_info(self):
return (‘%s:%d,%s’ % (self.__name, self.__age, self.__gender))
def get_name_age_gender(self):
return self.__name, self.__age, self.__gender
def modify_parameters(self, name, age, gender):
self.__name = name
self.__age = age
self.__gender = gender
return self.__name, self.__age, self.__gender
person_1 = per_info(‘yuhanyu’, 22, ‘male’)
print(person_1.show_info()) # True
print(person_1.get_name_age_gender()) # True
print(person_1.modify_parameters(‘amu’, 23, ‘female’))
print(person_1._per_info__name)