What is good practice way to separate writer operation from Object. Composition or inheritance ?
For example,
class Person:
def __init_(self, name, age):
self._name = name
self._age = age
def get_new_age(self):
....
def get_name(self):
...
def write(self): #write to file for example
....
Aucun commentaire:
Enregistrer un commentaire