Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
45 views
12 pages
Opp's Assignment2
Uploaded by
dadhichsharmadivya
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save opp's_assignment2 For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
45 views
12 pages
Opp's Assignment2
Uploaded by
dadhichsharmadivya
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save opp's_assignment2 For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save opp's_assignment2 For Later
You are on page 1
/ 12
Search
Fullscreen
PARRA fmafele comahu ctor: pats uc too U1 Can static variable access Dyex, Tin crt, We com access Stetic vorrtobles Popa tele Stotic vseiables ae associated esith the class rather thea with com be actersed -brom ary rember v 6 Twstonces of the css, So the Pes eireteleg eoustruchte TAD row victael aleatructors affer from nero! deatructows? howe a class pienanchy Fs A virhol destructor: (4 used when OF trveluing. poymorpiterr. The mom chigfenouce Lefween a virtuol destructor aural normed clestructer ies Tr owls they esalle. object olesteus tow iy podym ery re cceuasioss Usivy uietuolWalespuctoy ensure thot the -lestruchy ch att clossesa fm the hierarchy are catlecl pry when deleting om object-throvghr a fase cod pinky, tle ty Lftoent i Le - (31 Hew text file te bho fem oh Pe cei oh ple Ava A text ple aud a Bek fue axe 0 ik ar bd uses to steve axel mavoge Nolote. The key difference ties Tn he? zjes stese clots or he ented. Tent 4A es steve clon in ik Mae ra the dats is stored aud 30 readable text, ote binery he stores, # bina fe [4] What is pure Virtual, tion 2, Hon is 0. virtuol tumtt par A 2 virtual toe a. pote class but et no Fenplemertation prov ord. A class canton! ts detaxed using the “virtuel” keg meee pure virtuel bons ts Polled om ostract clost: tual pase lass? t claw Oo class thet UY meant to be used ara stuol inhexiteuce + VUirtool ed Tn jor thet is decle wdeol fn thot clo i Bne or (5) Whet is vir ftir virtuol bose - BS base class other classes wsing vt fnhediemece 4 8 en tid tne exection of meMuple Futeneet oa bose chord wher | oppeses multiple times Prom Inheritance there [eI Hows mong oy to ope a file Mpello-txt” fy C++? Pras - nett, tee Ke ceyenod te open 9 pile using the ' fel: ifstream ame fess Ve provides fovett be has file Sopot acd output: Hane, one O cermin, OE Fe to ope a te ermiee! “hatlo.ixt.” - Dafowtt csutructor a> Srput ile ctream (ffsheam) 2 streor (ofstseam) — 4. Bim gla. ettwols has 45 sponte tie eee » 3 Output $2 Each + ese ™ © scanned with OKEN ScannerCOCO lLlLlllt—S— TA nasty’ cen, exception? faa > An excepting is am uaenpe thet oceuuns ducing Normal fou of tre Uprogram Exception and exception eee ede Pa Peon csubrllad anol otrichoved way thay troclitional erosr-checkivg menor » (8) Differentiate Leheten class templode ond fev” femplote- Ass = Claes femploter one cteol ov expesfed enceptional expen the exeartion of a peyeom and disrupts the axe Used to howell erorong used to create gue classer- These claster cau wesk with crtbeak dota types wohile Pansicting the same fakenface ox bohowter. = Fumetion templetes axe Gsed to cueote qurcnic punchiont« Wiese ehiows com openote ov obiifencet data types vithoot the to coer fe seponate hae iad each “are: (9) Differertiote between enor anol excep tiny fur Gere? Pr evn in & he picot| nefers to a problen tin the ty Esumus can be c Feed fato hoo mo 2 (lb -fime ili eae, eas Ercagtion + Pr exception in CH ib 2 mechanism a rowel va Fae een I a maxe Catholleo| aud struvtured e Jetting the program temminolt obrupt\y, Excep oy m0) t Pole eu 4 aia esas as Ree opprepricte po ts tne Progen. [re] whet of correo Hy + jo you mean lote birding aol conly 7. - Bony Bineting (static Biraing)! eal Vircligg Hafera to the proceat eagociating & eae cali with the actual cade to be executed Pe eer ile eae alles ees tant oni ot compile ~ ation to col & male me aad the acldners of the fraction is Lowad to tre coll: Lee Brey Copter) Tete erntiny mefens to the proses 4 associatirg “0 ee call with the achial code to be executed of pak The aleaisionyebouks taille ekion +o cot is atexcferned aati 29 . ‘ oe sity roy arcocioted with pelfmerhen et © scanned with OKEN ScannerCC —_—LL———————<—<——————— tum ey) LUFT “En plas PARE -B_ “plain coustant tote member auc corstart member ust +t program Ani In Cit, a corstart dota member with the ‘coust joble of ih @ memben vor foi Holized, " pay wore, Once eis class {rat (1 declared the value of 0 couatert cjota member cauthot be mectifien Hough ti the object: Constant clota membert ant ogten out the Aife'time Used to Preprese volues” thet could not be chasse! opto tot object cs created, ‘ nection ke a memb paretie A coustamt member fe gd, Tt @ promise that the f or qauction tnt i dec laxed with the Naoust” kay wer not medity the stete sh the objet on cohich it is catted, Cons membeX wetions ane US choy woskivg tly corset olf pee coeneiore to Sure tot colire go member fenetion aoearnt after the object's stole. u Jerat clata memioer and dlocta mente Here am example tUnabeoting bot, Cos fonctions Pear a tt Include < fosheam > class ais 4{ public ¢ cost fut constant Value 3 class Link vale) : Coustenct Vole / anitioize coustout J/coustont alata memboet fm (wedi P< é ho < ) clota member [extra tor to MW cexvstout member peas void displey ©) coust t kd: 1 couk<< * Cmstant Valne ."<< emustant Value << std zsendl; ag [non-constant clots member fonction iby Volue iat nenvolue) t void m 1S yee ale 5 a }> cmvat_ casts fut &> Ceonstant Vata fut moin () 4 const MyClass olf 1 (42) 5 aif apis O> Myclass olof.2 (9995 obj2- disc! a obja-me hy Vole (11) 5 obja lisp las vetury 05 oe © scanned with OKEN ScannerOO 2 : A a U 7 Wihet ta qeuuete, proprammine ? How Tt Fenplemented fn c¥ #7 nite Prqram to Tenplewnerted or wing templates : Fins: Geuerie Pro, a ae hag tn ott Pow Being code ty @ wooly that is Tratepentient + dota type, adgor ty aud data pleetes te be wiitten! and & doe eg. The methe eae ipa geraminain (4 Smplemes Yi fe preqrarcesig p Yue cole Mnerease the efficieroy Cease» tJ. Code Revwilty * Acvautege et Prenat oe Py eararan 2. Avoid fuuction Bessie 3.0 once written it cam be Used hr multiple times aul eal lotes. HD Cre qouete proyrarinvg implemented vsirg 42 FJemplatet cllow to write cade thet wosks with og dota types by a basic ovediod: Porameterizing the typed. Here's Ie Function Templates: cee calcu template : templote
templote x ty gename T> Space (vay, ae) mee a : bee et 5 Pubife : Coutaines (7 vel): Value Cuar) 4 > T getvatuet? cost qfyehumm volue 5 3. Tenplote Speciodication : ms template <> clase Cautotner
4 chore Vole 5 Cortainen (char val): value (tslower(var)) 7 } private : peblic : . chor get Value () Cost Tovey vale, 3 ie Feurckion Template ith Muttiple Pasometer : template < a fae tc T; Spano: U> T custom Cast (U vetue) 4 qetus Static cost
Value) 5 ag Be 1 Crt program ing to Fmplement Bubble Sort alg templat fan us H fin cludes fostream> using namespace Stel late
void bubbleSest (T at7, fut) 7 tem © scanned with OKEN Scanner44 (acii
Ree old t,t Fut a5] 410, s® 20,40,20}3 fut n= sizer a /atzerh OOO) bubble Sost < Puts (arn) eoutces Sorted Ud * 3 et cout Pe ciiiiicoen wee tout =< end 5 pepe (°3 t Joy tems «+d a) Ithok is aynamie Biroling 2 explain tne omeept + virtual qonetion usith the help oun example: Drona: Biratin ayer co the pr the ackuol metho ow potion coll ts determine! © col determine ab suutioe other thay compile times Lr object erenten prayers ths opien envolves CLINT uirdual t — A virtual fosetion Ba feretion declared In a bare Coe trot < be overridden Q derives! lok: Exowple ye Geet # mncudeciostyeom > class shore 4 Poclice wmsiwenies <° 22 cout << “proiny a shope tee stds dS ys Putt Dynamic Binding: >| draw 0) oveuside 4 tat Ge or es ere sts * ends py > clos Sport > Public Shope x public? ela obra O weet 4 2 ght cout <<" Drowif ° square” stl: Beate Ty; jut mo O ie chape™ shope | cones rece); eyes ee a squane 3 shape | > apa) > 7> dow 5 delete shape 13 | dente Hopes cretwuy 05 4 © scanned with OKEN ScannerEE : poe of a number. The OY] Kisite am tetesactive prgrmam to find, Aaa f japakive, am Input valuer must pe tated for validity , 4p % 3 exception must be xalsed by Ure" (his tnd Power of Ava‘ ; norm trot coleusotes the | b Pai Hexels a simple c++ preguom MRED apie? : Naud lug: A number handling negative Inputs vith fe q H Inoluole
exponent 5 1 cins> bases Aoulle result = power (hore, exponent) 5 Stas: covt<< base ce "Ace exponent aso "ec neult
at Pndtudle< fstream > a Inclucle< egte Ub> using namespace stels am thet courts Limes aud choracten fut main ©) 1 ifstream lrpeeainle C'Demo.txt") 5 If hack if tel fee cou ne opeted | © scanned with OKEN ScannerC—O 4b CL inpotetle ts oper) 4 tre !Demo-tat! \!'5 Com <<" Erv0¥ opens 6 defuse expt pAILURES } Tot Une Cant = 05 Tut char Coumt = 05 chon chy 1 (oop Hw each chanacter wv the fue Urdtle (tnputFreget (h))t char Goumt +4 5 U check ad ess ed fo count Unes crete) 4 eomeert ss ST Un input File close Os Hf close the file As eas rs Unes "<< Une Count << endl s cout ce "Number of i ene cout
class member access appeal yo (2) > Stope score lation (22) > See operator [sizerg iJ > Canali tianol openotos (~2-1—) such specicel * The mechanism of avin 3s kmsven a8 openator overloading « J H Hone are some surle to follow orhon overtooshivg oF rexotors 2 It 1. Oveseloacled ator: 4 cab Jesst One operare baa ae pie) pe st have ct Jeaat one ope of operanels ts oe operator ¢ cd Quertoad exis Die pBEeii atic Pore. the nucbe 3 We com not create neo operaters, ones: ae F Us Te ovectoosled epercturis precedente anol agsoriatiulty sremainn the same. tH lets cr0eole ionic: ott ees 4 exodtrs overtoadivg te cancaterrote two strings uaivg the "#" opecotor? Be Tyclude
oan namespace Sts Fut mon 6) 1 string sty} str2, veal (3 jut TS cout
> StTI > eauted “Enter the seem shig "5 cinm stras wp (0204 Ce Strtsizel D5 c+Hd wesudt = veautt + seqCt] ; f te" (t05 (
ft freludle < esuio > F ag veeespeey stb clas Pose meer eae Crea]: public ? jak wale 5 void grt Ot pace ates tree bite ra cinys name> x arena ete eg code oh pect :"5 elem aes, Uke, so classp & Probie Uy cin >> ic UO yor tapleg Ce acer Aye) ates Conte off the pan: nectndes ate class geo 2 utvtuol public person 4 eae: ¢ Hoot pe gu it — ii "Suter the ree? cin>> pags t Jecnomes ”s > © scanned with OKEN Scannervoid displ U1 ; coat ceed ce "Poy 2 "<< poy 3 Vs class admins ufyhuat public psa 4 | public 2 Rfecpeces veil grec t aie Reena te eden the capemat’ > cin >> enpestionte 5 3 votd display 0 ¢ ; aS. Pee erpegeucesfecexpencute; J)? class master? publte Peccucs pore “Amn AE puldic? cyan ntiee]) fd get tot (4 Pe vei apace eaten tHe PTY dine ns f Aven, 53> ot i Mg ee teeny yome © scanned with OKEN Scanner
You might also like
OOP Prelim Paper Solution
PDF
No ratings yet
OOP Prelim Paper Solution
27 pages
Oops Assignment
PDF
No ratings yet
Oops Assignment
11 pages
OOPS Notes ? - Removed
PDF
No ratings yet
OOPS Notes ? - Removed
20 pages
CPP Notes - 03
PDF
No ratings yet
CPP Notes - 03
30 pages
Oops - Assignment4 (Piyush Nayak)
PDF
No ratings yet
Oops - Assignment4 (Piyush Nayak)
12 pages
Oops Notes Curated by Sameer Raza
PDF
No ratings yet
Oops Notes Curated by Sameer Raza
21 pages
Adobe Scan 19 Oct 2024
PDF
No ratings yet
Adobe Scan 19 Oct 2024
20 pages
Endsem Paper 3
PDF
No ratings yet
Endsem Paper 3
45 pages
Oop
PDF
No ratings yet
Oop
20 pages
Oop End-Sem Full
PDF
No ratings yet
Oop End-Sem Full
48 pages
1SG19IS043 - Karthik Bharadwaj.P - OOC
PDF
No ratings yet
1SG19IS043 - Karthik Bharadwaj.P - OOC
17 pages
Computer Programing Lab PDF
PDF
No ratings yet
Computer Programing Lab PDF
105 pages
Oops
PDF
No ratings yet
Oops
21 pages
CPP Notes - 02
PDF
No ratings yet
CPP Notes - 02
30 pages
OOPS Handwritten Notes
PDF
No ratings yet
OOPS Handwritten Notes
20 pages
Imgtopdf 2909221401056
PDF
No ratings yet
Imgtopdf 2909221401056
39 pages
OOP Assignment 5 and 6
PDF
No ratings yet
OOP Assignment 5 and 6
12 pages
CPP Notes - 01
PDF
No ratings yet
CPP Notes - 01
30 pages
Oops Assignment 2
PDF
No ratings yet
Oops Assignment 2
11 pages
Java Notes by Ashutosh Sharma
PDF
No ratings yet
Java Notes by Ashutosh Sharma
20 pages
CS201 Handwritten Short Notes (VUAnswer - Com) Handwritten
PDF
No ratings yet
CS201 Handwritten Short Notes (VUAnswer - Com) Handwritten
13 pages
C++ Notes From Expert
PDF
No ratings yet
C++ Notes From Expert
115 pages
C++ Notes FULL - Compressed
PDF
No ratings yet
C++ Notes FULL - Compressed
176 pages
OOPS Notes 4th Sem
PDF
No ratings yet
OOPS Notes 4th Sem
7 pages
OOPS
PDF
No ratings yet
OOPS
53 pages
OOPSDA23BCA0186
PDF
No ratings yet
OOPSDA23BCA0186
7 pages
OOSD
PDF
No ratings yet
OOSD
20 pages
OOP Practical
PDF
No ratings yet
OOP Practical
30 pages
Unit 1 (B)
PDF
No ratings yet
Unit 1 (B)
25 pages
Oops 03
PDF
No ratings yet
Oops 03
14 pages
C++ (Unit-3) No Operator Overloading
PDF
No ratings yet
C++ (Unit-3) No Operator Overloading
21 pages
Computer Notes (Complete)
PDF
No ratings yet
Computer Notes (Complete)
128 pages
C# Topic 2nd 3rd
PDF
No ratings yet
C# Topic 2nd 3rd
36 pages
C - Home Assignment
PDF
No ratings yet
C - Home Assignment
8 pages
OOP Endsem Notes by DK ?
PDF
No ratings yet
OOP Endsem Notes by DK ?
27 pages
Classes and Objects Part1
PDF
No ratings yet
Classes and Objects Part1
25 pages
Oop-End-Sem-Full-Oop - Proper Decode
PDF
100% (1)
Oop-End-Sem-Full-Oop - Proper Decode
48 pages
Oops Assignment 1
PDF
No ratings yet
Oops Assignment 1
6 pages
DocScanner 30 Sept 2024 2 33 PM
PDF
No ratings yet
DocScanner 30 Sept 2024 2 33 PM
12 pages
JAVA Middleware
PDF
No ratings yet
JAVA Middleware
34 pages
C++ Interview Questions 2
PDF
No ratings yet
C++ Interview Questions 2
6 pages
Java 6
PDF
No ratings yet
Java 6
32 pages
18MCC23C U5
PDF
No ratings yet
18MCC23C U5
7 pages
Abstraction&Multiple Inheritance
PDF
No ratings yet
Abstraction&Multiple Inheritance
18 pages
Opp Ass2
PDF
No ratings yet
Opp Ass2
10 pages
Adobe Scan 21-Dec-2024
PDF
No ratings yet
Adobe Scan 21-Dec-2024
29 pages
Dashrath Nandan Java (Unit1) Notes - Alasso
PDF
No ratings yet
Dashrath Nandan Java (Unit1) Notes - Alasso
11 pages
UNIT:1 Þashath: A Pupiam
PDF
No ratings yet
UNIT:1 Þashath: A Pupiam
49 pages
C++
PDF
No ratings yet
C++
22 pages
OOPs Unit - 1 and 2
PDF
No ratings yet
OOPs Unit - 1 and 2
61 pages
Oop Assign 3
PDF
No ratings yet
Oop Assign 3
5 pages
Rupkatha Bhattacharya, Roll No - 03, CB303, Assignment
PDF
No ratings yet
Rupkatha Bhattacharya, Roll No - 03, CB303, Assignment
4 pages
12304005N54272 46960 Oop-1
PDF
No ratings yet
12304005N54272 46960 Oop-1
9 pages
C++ Notes
PDF
No ratings yet
C++ Notes
12 pages
Oops 1
PDF
No ratings yet
Oops 1
17 pages
8th August Classwork
PDF
No ratings yet
8th August Classwork
3 pages
C++ and Oops
PDF
No ratings yet
C++ and Oops
29 pages
Oops Assignment
PDF
No ratings yet
Oops Assignment
18 pages
OOP Assignment No 2
PDF
No ratings yet
OOP Assignment No 2
10 pages