-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhouse.py
More file actions
29 lines (24 loc) · 803 Bytes
/
house.py
File metadata and controls
29 lines (24 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- coding: UTF8 -*-
__author__ = 'Administrator'
# house.py
class HousePark:
lastname = "박"
def __init__(self, name):
self.fullname = self.lastname + name
def travel(self, where):
print("%s, %s여행을 가다." % (self.fullname, where))
def love(self, other):
print("%s, %s 사랑에 빠졌네" % (self.fullname, other.fullname))
def __add__(self, other):
print("%s, %s 결혼했네" % (self.fullname, other.fullname))
def __del__(self):
print("%s 죽네" % self.fullname)
class HouseKim(HousePark):
lastname = "김"
def travel(self, where, day):
print("%s, %s여행 %d일 가네." % (self.fullname, where, day))
pey = HousePark("응용")
juliet = HouseKim("줄리엣")
pey.love(juliet)
pey + juliet
juliet + pey