Skip to content

Commit

Permalink
Update oop.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jaekyuoh authored Mar 11, 2019
1 parent d2a371b commit 309fa59
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Object-Oriented/6-property-decorator/oop.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 309fa59

Please sign in to comment.