From 309fa59d4def51fa548fec29832cc1887379fda9 Mon Sep 17 00:00:00 2001 From: jaekyuoh Date: Mon, 11 Mar 2019 17:35:38 +0900 Subject: [PATCH] Update oop.py --- Object-Oriented/6-property-decorator/oop.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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