Professional Documents
Culture Documents
Oop - Chap 4 (2063)
Oop - Chap 4 (2063)
a
class _ space _ a
eee ea
—___pulic: a
void getdate Cint a, int b, int ¢)
La;
‘Scanned with CamScanner. e)
- a played} Hach
ns dh dhelnsi
J.
veh er ehenelar 6) funallan
The Ainctian operator <6) (mker ne Caputeint Ah
Paneer the it dada menbard’ er Whe obtel:
S. sin tla Pureton (a a member Punetin of Me
tame clit, Te can cliveadip acces Me menher of dhe
objet which eh veel
overleading’ unavy minut operator using” felened Purabtan «
WinchudeZ fostream: h»
# included sonia: n>
pinched
class space,
Sa
int *y,e;
ae a gaa TT a, We b, Yak ed
2 j meas
os
‘Scanned with CamScannerCOuheeee are, callin
s- earlate: .
Fs
‘Scanned with CamScannerding’ binar =
__Tedulras_ hod operords 4o_yorforn. “operabion, _--_
—Felnhg_Fregren shows hro_bieery + opembor_is__
—— TF
include 2 iostrenm « hp
include £sbvingsh
Class, concat ah
{
har str (uel;
‘Scanned with CamScanner‘Scanned with CamScanner~ Hinelude 2 Jeatream. >
_ Findudec Biing: n>
“das concat .
4 °
Cheur BhrCt0y oo a
ub Tic ; : a
void tnpukey i contrveh
: Concatey
Course Entog er the ashing a a Ae
Ciin>> str; . Ww
+ Se
_ Vere)
Concar opowator + Caan cab x) 5
‘Scanned with CamScannerfencat er, co. cs: :
@ ae
y “Inputed; : Be
tout 2e6inin stein boFere concakenalion®
age ee
te y
‘Scanned with CamScanner—tusteading —Vinany operat using’ Friend Funsien-
inolu, oh
los
—tiloelude Cabingshy
Claws concab
ee UL
char stylue:
publics
7 Void inpubey
- i:
coub2e*in enter a thing:
eins atr:
et
3
a a
void dlisplayey
qoulee*\p ehing 1s: ™ zesty,
A
‘Scanned with CamScannerConca ct cry :
tobe 3
an thilapabt fe
Crs Inpub ers Lt — -
toubectetnin Giving before calenahion : \n%?
+ Chealisplay ey: i
reenkct pt dog ater toncalenalin fia?
SOULE nln shin? ePterconcsenahion s\nOty
COUdL LEE n\n Bhan
Operahor 4+ Cc) ers
aS
Rules Por _overlnadin Operators - e
enh existing op coordleg can be evesloade). New operate:
cannot -be create.
2) The evertoaded operator soust have at least. one operane!
thed is oF wey defined type.
8) We cannot change: the basic rmeaningy of an Operator.
that is we cannot edefine the Plat (+) operator to
Substyack one value Prom the cher.
4) puerloaded operators Pollo: the _syntar tales oF the
es
otors that connst “be —
‘Scanned with CamScanner@\3
6) nowy oporaors overloaded by moang of 4 rmembor
function, takes no ents and welurn ne values
Sub thate Unary oporater OUerfraded by Means oF a
frond funch take one weferonce ene -
9 Binary oparators overloaded Arough a member Punckon
“Fake one. argument and these which cre ovestoa
Haugh a Friend fFunehion take two ents
§) when using, bin spoxators Overloaded though 4 rrembor
Funelisn, the \eht-hand eperand snugt be Gn object of
the ‘elevant class - :
_9) Binary axthmatc. operators such as +, -) * | musk
welurn a value. They mutt not attempt ts Change
they ents.
ts) we, cannot use Friend Funehons te overtoad certain