0% found this document useful (0 votes)
10 views

C++ Assignment - 2-compressed

The document discusses programming concepts related to functions, data types, and classes in a programming language. It explains the definition and usage of functions, the importance of data types, and how to define classes and objects. Additionally, it includes examples and highlights the differences between public and private access modifiers.

Uploaded by

2303466200438
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

C++ Assignment - 2-compressed

The document discusses programming concepts related to functions, data types, and classes in a programming language. It explains the definition and usage of functions, the importance of data types, and how to define classes and objects. Additionally, it includes examples and highlights the differences between public and private access modifiers.

Uploaded by

2303466200438
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

tunctlen

Oetine t
and that a unction
RetYn "the declara
tjn
tpe A A
iasoh mpotthctbns
tere en
hototypei fKhctn ent-2
Assignh
Cihtx);
Absolyte
iht ht ot ntjon
typ e
the
para
pyoto tor is
het 4ed
gah tye
reihscode;
a
block
&boYtte opetoh
S
a ot
decetbh
typeot
he
hehbey certalh (ode
ethethe

tend actbns,yd that


of PAGE OATE

PYer
Vicyalekhars
Kihd
tho co
de teS
Value), oftctb
ther
a
DATE
PAGE

AA fuh cfbn declentjn Cn (3nore


iBnere the
he arm mer4
hates but fun ction dekjnt jon cahnot
The yoid data type Specities an ehptz Set of iahets
Thee tery the

Vo jd fuKÆ ibn haheCtist ot aYMhen ts


Functib n ca
Caahot be Sed h ah asssn hetS trtehes

we hae to delae
it doer' t Ccept ahy arnments

Detine an
an ln 'he fn4j2m with fxarpk

aie function
| lnethe tohpile

each poht value tgs the t hctienis calles at


cohpile
(tt podes in ine ty (ton to redye tho
Vvityalckhan
DATE
PAGE

alihe etutee funcejsn hcheCarahe fr2s

the ¡ lled f h tbh. Byt the aees fro whele the


fun ctibn 'a ctllly called and the
the f Ctib h ditfe eht

But when the /hline fvntjeh is called. thenthe


de finitn ot 4he to (t. there
lot ottiAe
deocass the oehead.

fin(ude <isos treeh

3
Vidvalekhn
DATE
PAGE

xplajndetault Con staht aYhent th exahple

DetayIt Aguhehtsi

atheht a Valhe n the


fqh tion ccaratioh elleetsn
assimed by the cohgjler it the callihstyn sp n does
hot to the

2xehplei

O.Ths means thet iE


only Argehey t. Bych as
be . Set to

exahple tosho aYgUheyt Ch be


sedi
Vidyalekhan
DATE
PAGE

Const arnheht

an4
want youY ahes f be chahaed or hoditNd by the

ln cttyon (an p4s fy lctibh aryhents as


Coh tain
that the vayes'ot the aghent ^Canho be chahse.

(an be
fnetths don't a dvetentle

exaaple
#ihchyde<(ostea h

Orile (ode
int haih
Vidyalekhans
DATE
PAGE

ExpkinFbettbn calling
- while Crathe Ctt fn ctbh re heave a detjitta
-wht the t (tbn
thatFejon.
bhen a progah calls
Contol isshtted to
tke Ca lled fun cbnA
Celle pertoYs detihed K atter
|whole Code whohits netn Stete feyta

maied anhehts al Dng uith thcfion mahe

exahple'
#ncYde <ioste)

ht hajnc)

htaslol;

Cou t
Vidyalekhan
DATE

Detine class & Obrce


Classi
A chssis a 2rdetines tne thace
Conteih data hehbe and hebe fun ction S

Yau can detine Lclas y5ing the dass tey kor d,


lan d Coeett ohitctc of thct class Vsihs the new
key ord

Gxaple=
chssty (as
Publ;ci
stríng hyString;
Vidyalekhan
DATE
PAGE

Obiect
A, Ohject is an inst. a

class is deticd, no mehory is allo(ated by t when it


Cass.when a
LS noked hehey is alloC4ted.

CAAte en objat of My (eSs Spe Cite the class


hehe cotloued by the obiect hahe and o dceS the

oh the sbicet

eXahplei
class MyCkss

String sthihs

MClass hybii
hy Objmy Strihs "lnl Uhiexiy

15
parul Onjlersity
prirate.
Pyblie
bXahple cless
nemespae
Std Msing
iostea
h> hwde #nc
be
Cant enbes mdata ate he
Cohtaihte which Sectbn
teed 2hd pvate publËc, has ctt clauËn A
PAGE
halekhan OATE
Vidyalekhan
PAGE

(O4tput3- Puble tunclbn alled


Pate Fctien called

tthat i5 rjent Fyhcby ?Explain ith Mehple


whjeh Aas aces to all the
protcted hehheos
By ysihs the ker word trjeh d cohpjle yll hno
that gien fEtbh iS

De dartibn afrien d tyhctbn tet be


isiee the bods Dt a cless that bajh S.
0ecl<tjbh!

cass cess_hahe

brenc deta tye


tye tyhctbyhahe Cos hent s);
Vidyalekhañ
DATE
PAGE

icyde <lostrahl
nahespgle St5
class letansle

rivate
int ens thj
int bizth;
Publie

length=L

tend jnt Celeu{atefea (Rectensle x;

(nt cala lete Aea (Rectangle

Caat c<Aree 'ot the rectengle

outyt
Ara ot the roka Ngle :50

You might also like