class Person:
__address = "n/a"
__name = "n/a"
__age = 0
def set_name(self, n):
self.__name = n
def get_name(self):
return self.__name
def set_age(self, a):
self.__age = a
def get_age(self):
return self.__age
def set_address(self, a):
self.__address = a
def get_address(self):
return self.__address
def description_of_person(self):
print("---------------------")
print("| My name is ", self.__name)
print("| I'm ", self.__age ,"years old.")
print("| My address is ",self.__address)
person1 = Person()
person2 = Person()
person1.set_name('John')
person1.set_age(23)
person1.set_address('dom 13')
person2.set_name('Mike')
person2.set_age(16)
person2.set_address('dom 5')
person1.description_of_person()
person2.description_of_person()
Если убрать здесь все геттеры, это не повлияет на результат. Так к чему они?