diff --git a/Object-Oriented/6-property-decorator/oop.py b/Object-Oriented/6-property-decorator/oop.py index a536e93fb..3ba793e0b 100644 --- a/Object-Oriented/6-property-decorator/oop.py +++ b/Object-Oriented/6-property-decorator/oop.py @@ -12,10 +12,25 @@ def email(self): @property def fullname(self): return '{} {}'.format(self.first, self.last) + + @fullname.setter + def fullname(self, name): + first, last = name.split(' ') + self.first = first + self.last = last + + @fullname.deleter + def fullname(self): + print('Delete Name!') + self.first = None + self.last = None emp_1 = Employee('John', 'Smith') +emp_1.fullname = "Corey Schafer" print(emp_1.first) print(emp_1.email) print(emp_1.fullname) + +del emp_1.fullname