opexador
ie Opesator, Londing. memdiom
respetie
to be over loaclod in
Tyhon.
over loadinay me an
behawio opoadore bod
operosd, thot dey
(ouide admdod beyond dhiy
Drediine d opeo atienal meanivy).
Tie op adergi -add -Sub
print
Additioml (t)
medho d: -- add (sell, dher)
his method uyed do over Coad thho
+ operoator to dyint Cwstom addition.
clas addidion
det --init -- (ses, x, y:
det --add-(Se, odher)i
return addihon ( Beldx + odher.x
VI addi dion (3,3)
V2
VI+ V2
Bub ha thiorn(-)
metto d -- Sab- (se), oter)
-5 his medlso is wed to over oad dha
dele Subbsachio, be ut'or
do
clas poi vt
det ini(
iniialige
det -- Sub --
retun point sel. n - odkr.x
Sey- odher. y)
PI SPbint (s,)
P2 >point (2,3)
wes due Subme dho d
Eauality (= =)
medod -- Cy--(sel otun
wsed to overloao e
opesada do dayine Cuutm e aualidy
Compar ison behayior.
Ex clas Book
oleinit-()
#init teucho
deti--ey--(sel, oda):
b Book
b2 = Book
&hing Repekmtation (str (o)
mdhol
tued o dyine how an obied
whn SkC)
ib vepelrld as aAbing
Print () is callod
clas pevhon :
def -rinit (Sel, name):
name 2 Mane
s - (se):
yean t se. name
p evsn ('Alice") medhod.
pint (P) # Wses
trngdaMethod:
- (en C) '.
Csel)
do d e te behaui or
) This me fhod is cucd kam called
oha (enc) tun chon
Object.
alas Box:
def --init ~-( sey , im):
sell. items itmy.
Csell)
(sly. idomy)
b- Box( C,2, s;4)
pint (len Cb)) # wses
--len-- neBod