Page :
Date
- abject ohject oaientod
fupingprddia
Pasadifa. elSe be toseda Metbed to solve Sme
Gy, do Some
Ooy also
Janguage
Soye
a
ale can
Some fpahat
29 23
agial
Meia's pillas
Ginhotance ASceCEien
Objecs bMehae plyphita,
V-12
Animaelg
Bis
Methid
Peycoek
obec
class
ctasss +heoIte celer of obs¿cts
obiécAs
1 > ClaSs is mot ed eal cuos H PNEHy. 1t 7s Jst cc
is cc. template
A7 class does not
OCcup meney
Star
Qcress moifie class dlassfNume
-method
Methol
AA sek of codes
ich pefenm
Advantcoge Partulu tesK
code
Cue Gesabiity
opti mztion
Cccess-mdifier tm-type
metod /one
Page :
Date :
object
Of elcIss
ohiect s
Object ocupies enelay
Objet onsi Ste of
OfNenty adme
| Be heavieas EE unhelauitouY Diprejee method
ne nstamcec) taehed
cloneC) mekhe
Tnstctiua Animal buzo
Tnitilizitlon = neo AnimelC)
Snacixk nime
class
public oid ee)
22
Syem:out. poinuth ( am
Public satic Verd neriy
soP('):
Animal buzo ned Aning/C:
TOvaC fle.scva
davg
ouput
hu refrnce Vangig be
f by By sing Metted
Cass Animy!
Anina i
Class nime stoiny colog2
veid initoains c,in)
int cges
pubic skaic vötd man (Stelnytg orgs)
Vold displuy C)
Animal buzo ne Arinal(O:
S.o.pC bu20.Co ( Animal bv20 ne Anima
bueo. Initobi ("%lect,1)
bizo. display ()
bläck, 10
ConstuCtor S
fcoyistHoY
OS C block Gimiloy tomethOs hevn Sqyne
Same cmQ
Delnothee
h e only meAc:eunype
medfies
ubli.
Pcecute
objec. automcticelly hencoe
class Tes
-Publis
Psym
Test taneoTesc: .
V-12
bjet
ConsuctoY Uset
Class Empbyee
Stoing nemes
in emp-jd nomesint tmp. i
Steing
2hiS,name anerne
.Lispuic Sutic veid mtn(iringc3 axgs)
Enployee 613neEmployee deepuik, Tot);
e2 ne EmplbyeeC' ab,z2)
t. Pefcylt Constructo 9.No-og (onsUCOY 3. s8rized
Cno-cg constutS Cuses defined) CoNSTuttos
TCempìlevoutoynetical cluss Test
CarstouctoY generate classTest
cuss Tes t
Testck
Test C)
Test Sring neme)
wdefouit
Constructo
3 super(, Psvm StinyCJonGs)
Psvmring tJarg ) Test
Test t=New TEHCO; has Tes+(lee
Page :
Date:
child class
cless Aniynet
Yoideat C)
SgsAesn. outapaintlan
esctendg Amimel
class DO
Syeuei'e noid main SAno1engs
Public.
Deg
d ect() RelukinShiA
hima
Advunt9e
PodeRenasability
DiSAstamge merogaesan
V-12 |clesser qes tlghtly Cuplad
of Tnheton ce
-> Tpes
(22 mul+iple oe
Hicaita)
Inheri-4Cne lHYbid
class
D
etass
mem
class t
Ctass C, ecteh B
.("a class method
S,o-Ph ("e class metho;
Cl«ss B exten
Pablie stie vota main(GsyOng)
Veid SlesC)
S.o.Pln ("b Cless method Obi.shácoA C)?
Psbli<
sREie void ain(Sirg CJaags) Bobmec BC)
A CbI= n AO} Ob2sioJAC)
Obish csACO; ob2.ShogC);
ObO ShodA ObSheAC
ob 3. shoc )
Gut prlt a,class method
Outrt
b cluss' method ciessneh
4)
Page:
Daie:
tpolymephisa
Ferms
T9pes
Cempileme poly arphio,Cachieve)
method oUrlocldmy ( Statlc Co mote Hemdli
Rantimepolamaspbisn Dyhomi
meted Weinain Cockieve)
Methd
Seyme Same name
Same
ienk
Ne
of g -No.of
Sey
V-12
Seq
ass Tes
Voidshow (ita,sríng b
Veid Shoce
Mroid Sheori,
Abtie SeLeic void moin (SringC3 crgs)
TestC)
3
t-saoeo (to,20) tShes ("abe,z); t-Sheulro')
ackteve Method oVeloading by Cengig.
S
of the method only because of mot Passible, by chonging the oetnbi type
Con e
ognbiga
*Neoa ig Thiss hene M alwcMS Culls main metho cshich
Page :
Date :
cCkss Test
eld shaaC
S.e.pln
class Xyz eockent Tast
Sepla ("");
Tes+ kenea) TestC
XShocC)
s p i ces
ntern rapiementet to Bdust highliga
the sekup e
offering.
Ab S t s e t i o n
body (to melemeneae io)is
A method must Cl@oys
alcwoys be dectared in cn abSAxact ClaS S,
te if a class. her anebjee
class exterdS an cb t c t (ass , tien hp
Class
paxent elces os,t, has to be dect absrct
as ell.
be
ovevYiden in deyited ConceGte classes otrcoise corpile
oy I| be throcn,
AloSct cases Tcn nÔt be instantices
Of AbStre Ct- ecaigwe nt oecto
Class
absrct class ehicle Public Stric oid mcin (rng
crgs)
abStruct Void Start
C. Stertc)}
class Cs eoctenks Vehicle.
Void set() SCoote'ys ne Scootes
CIss Secter erHe hds Vehicte
Vold Sterst C)
So.pi 'Steeter. Sets caitti Key
Page :
Date:
Tntexface
hteaces
N
Weet a clags mist do hd hot bacs.
de echieve dbsaacticn
sppart multiplenlhexitunce
acuieue
S
ynter feice Noine.
eheds/L ciasrect
Public
elespuslie,
Stasion,
suatisAiel
defiul
metho Concaeê methcdpd
gth yesion
fiVete methcd
Vod Shocc, amheitS
class Test iaplemenAsTi
ubliswid Testt= nec
V-12
Emcipsufeuto
fnapsule eisn JCNA 1S a me chcinisn
Raviebles Cnd ode acirny on he dekca of upiping tae ate
simle unit (netteds) togetley
I. Declqre fhe wericble of a clos
2. Poovide Pbltc Settey Cnd qetey aspoivte
view the \lc bles ctlues. methed d fo modiM nd
naflaon the Vaiable of c clss aoil be hid de
of fttir Qu ent class. This Cohtept js 8sS Deke Hiding.
howM
cless Enployee
Pyivee int emp id
Public Veid SeeEmpid Cint e)
enmpid eid
Ribiic ynt get Emnpid()
Yetun, empia;
cluss Company
Abliç
e. sée Eropid (oT);
Sysm. out prtetn e. ges6npid C):
ourp;rto1
Page :
Date :
ás keyand is t e neforence Ycxicibletheitgefes
class Test
2=2
eid shasC) Out Put defoul¥o
So.pln (7):
Cass yZ
Þublic Skatis Neaid maia(aangi yag]
est tnecaTes)
V-12
s a e r e n e
-"'Supe Neycvod class obue
immedicte penent
class A
Class B tends A
S.o.p (Super. i);
Publie steeic Veid roin. (Ssing t] or9s)
Bob nÇa BC)
Pirel
Jf we (Tecte any Finalvaiuble, it becomegonstÜnE, lle onnat
Change the Yalue of fincl Vesic1ble
Cvecte Cny fnal ìethod,We cunnt ÖVeTyide it
ýf We ceOLte
y fioe1! class,! CaNnot o tnheiti
Page :
Date :
Trheitanle Poly manspiS
olynusphSalles
lt hhositan ce, e desiuedoass
pcistyclss methods le ecist
inhesit theabeudy
olacs fecute itends a
upiny hePolyoxphisna
Jonheitainçe etegi o ueiny
Strsu chyxe and behavic a£aehann he becavlo
class n c Subclasof poeht cless's meeck
Parent
anhexi tdnce is opplied te coss polyýnoxphisn îsnietlidCs.
applia 4o
Con he of Sihgle, hybaidpolymnphisq as kwc kypel!
t Tnhentemce KDcompletime 2)run tme
mul4i ple, hicancajcul, hlipcth,
mul4ileveltypoS
Code
alhat is
to deiign
ottue heIs-ce Tlatkuship
sed to iaplenalt Vicible tkE ertas
Object
velaebnh
Mehical ISA Lektlo Shi Electoiay Engine
V-12
Copy ontnucLor nd Pho iassignnnet opcsute%
bo Are used Ao initiali2e one iobjea usiny cmothes Okiet 4
corstru CY alocets sepact es memoy 4o
to botl
bjetS.
-> Assignmeiu opesaters es nat allocA e ne
fue n ly (seatd obiect; menos y