Oops
Oops
given below :
9 focus i- 00P Jocus on dta athes than PoP treat
Codes sequence pro ce duse,.
2.) Modulaiity ?- 00 P gaizes
0daanizes Code into objet cohich
bundle togethes clota and method, This
apfroach akes prog1am easies to manae
amdl maintain Compaed t Pofs linen fhso.
3)
Reasability: y wmg inhevitamce,
8ame cade and efeate
we can seed
cayses based on
he
Red, Detauts to
Yellow 1Defoutti to I
GYeen, l Detauts
Defat to 2
nt man ()?
Tra ic ight signal Red ;
if (signal: - Red )8
Cot << SToP;
else 4(s igal - yeen)
Cout <e"Geen
3
*| Block scope t- Exist wthin $3 and dust voyed atea
existing the block ;
Vo id fun (0f
Int
in y =20;
,f ny iss not acce ss ible heu
Vaiaþ le (nside a claK Car bp
Class Scope -
accessed using object.
Class student
nt x ;
:
Lle tine af a variabie
The dile time of aa Vaiable
Variable refs
a Vai able exist in) memo
* Auto maliu etime - when thei,
and cyeated
Vasiable declaned locally
is entered omd destoyedl cohen it
Scope
enited.
Void funlU
int temp=7; \\ Created here
Cout << temp;
} s destroyed hene
Statie i{etime
Veviable deoloxed as slatio as glabal
plobad scope exist for
entire proons duation.
static int coutt = o}
Void increment 0F
Cout ttj
int main
Base * base pt pointea to base clat
da
Deriveo obj Deived ;
base ptr= objpeí Ved 9 \\ base clas poinupomts to
deived obj
base ptY’ disp gcdls denived class duplag
method due to vitual
fan
WAP n
Mecwrion.
#include <iostsean
wsing name spas std;
int Sum Natwall int n)
(n==o) f
Yetyno;
retun n+ Sum Nbtual (n-);
int main()
int au Cn][m];
Cout <e Entey elemert: ";
for mt i-03 i<n; itt)
for (int j=D; jemitt
Cin >> au CiO ;
Cot<< Belore t ranspose 1< <endl;
for (int i= 0; i<n; it}f
for (int j=o; j<m ;jt t)f
Cout << au
Ouput
Entea the No. o Roup A colum : 2-2e
Before tanspose
1 2
3 4
Aftes tronose
1 3
2 4
AAP m ctt to
to creat Ptamid patln
# include <iosteam>
using namspace std;
Cout <e "Entes Rows:
Cìn ros ;
fos Cint i= tj iken ; i+)F
forl int j= ! j<njt) F
99
Cout <<
for (int k= ;k<2 Xi-I ; ktt)S (8)
Cout < x";
otput
Entes Rous i 4
Mycos se);
print Velu e (obj);
Void duplay ()
Cot <eyalue 3? <<value ;
onginal rahue : l0
Neg ated raue :-lo
( What us inline funclion? Erplain with exampe.
ast An inine uncon in ctt s a
hue thu
fundtion bohee the comle eplaces the funcity
Call oith the aetal funcion code at conmpile.
Lime Tha elimates the oveehead a a function
This
Call, buch as Jemmping b tho funetion's ocaor
an d selaning back, theby impsoring peyorma
-nce for small, (reguenty wed aTctfo.
# ineludes <iastseam>
using. namespace slds
inline . int Squaselint x) f
velusn X* X
int man U
int nu m S;
int Tesult = squage taum)
=
class s
Pu blic :
int opu etos * (ons t A 2 0bj 6)
return obi A. vauetS;
int main
A obj A410);
output
Valye o A
Resuir after ovea ladng :5
Ihat acce sS modiier in ctt ?
each
Ans. type. key w
osds that Contsol
Access 9odi4jer
the visibi lity and accessibility o cas
)embexs ) atri bute, and methods). they
letermine
ohich pasto o he progan Can
mity a parti cular mem be.
: ctr provde thsee types of acces modi{iu:
t. Public
privale
3.
Psotecte
Diesenee beto eey Access Molifie
Madyierg
A ccess
Access evel
|Modifies
|Publc Memhess declaed as pusie te
a cessible {stm anywheem the
|Psogam, o tside the class s cwell
Membes declosed as pi yate are
ony acces sible wthin the Same
chss other chssey or
tunetions can't diectly
access thos
nt se Sut numnum2 ;
Co ut <4ResNt <seslt
Fime : 3y
8yeau
Simple Intrest a (0SD