0% found this document useful (0 votes)
91 views24 pages

OOP Notes

Object oriented programming basic notes for bs computer science and technology degree.

Uploaded by

Zain Ali
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
0% found this document useful (0 votes)
91 views24 pages

OOP Notes

Object oriented programming basic notes for bs computer science and technology degree.

Uploaded by

Zain Ali
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
You are on page 1/ 24
| sect Ary person that participate our | System, ; | Oriented ‘rutreduction Progtaning =» Process the _ program. | Ces Syntax: 3 "Various Components ina _C4t+ Program Using namespace Sta; # include_ziostlean —»_Name space »Library [Header inclusion jont Theo n- here.« Matt have ‘ink’ ah Ey return _14pe. | Couk << “Hel Lord’; __, Pushing output to_contole. Jetiwns_o; Value must te_returned at the end_o} maint) f. \ st scanned with vamscann Using namespace — Std; a include _¢ iottreann mC _mua'n () | First nunbers a i - anne Second number t |” ——|| Cari —__Is 4 —|} __int_ayp, pos Cou 22 ERE number Cin >> as ~ - Cout << “Enter second nunder., tt Cin >> bs r Ci : ig? A ete yop tho nunders ics “ee aah, ; ; ( : 4 Q. Program tn. Ct i ——|] #4 include _< iostteamh S a _ # include <|conjo.h do Void in() 46 iS even - ; a * int_nfh | tL cbr scr), - Couk le “Enter a nymbets", — Cin dh 7 ————.|___ Scanned with CamScann Program (Be Cx) —Hinclide c iastreams o bas Wing manespace std; | eater. ainber © ain) is Cheese operation. © Do You want etter_anothe no: Val |__char button; EVs Repeal * t Lee. Lost Es Got 2 Chesed, @ Cot. 2e "Enter a digit_number'ee'end 4", > @ Cin) >s nln; ¢ Couk 2" choose what You wart "\nl. Table \np Factorial Cin.s> os; ‘endi's_® |__ Switch (chos) s —t | — : Case 4: Hy 3 Jor(int_isd_; izedo + 114) 4 Colbénumcd ‘Ke ecize "= "ccnumbiccend t'; * break; Cafedt | Cou. << “Hello”; : point fad fend jas) —_2= Scanned with CamScann ” — coutcc “Factorial op "ee nitin "is Pesiaccatnd cout cz"Do fot “enter would you “like to run this Pregten againg Wri "ce'end 1’; Cin ss bubton; a Pet. *y' Idutton » y ) Hincludecc its btean: is WI sinctud ez Stdio. Ti. Bincidecc Coniouh » —_]]] #enel Jude . Hpadey 1 —_wid_main() _|P_baid nain( JJ nnel jo oe Tinted a _ Searz("y. d", & Sun); | _Repleced: in *_ Cin a>hwns }__coutec"~xter a_numbers" z J 5 __| ~ele I} fretted} R _ on gn lew em ® H DIDS ae alrite a program that Pom __ufe yr ard___operat -Caluclate Sums struction. of Huei Ht tncludlee jostKeahg J #incdee conto.hs void _main() a inpuks two _rueberr or Symbol Prom bier ee Multiplication KH 97. _twWo numbers Sin p_ Switch Statement. Cheer Us it. Scanned with CamScann | cout oo "Eater two hwrbers:"; Cinds & sshz Cout ze" Exter any operators; — cw Cins> op ;_ x _ Switch (op) _ — Cafe 't's cout <2acg"4"2ehcc ath d 5 while( ce. lo) coukee n cet" C44 a3 Jet. Us Scanned with CamScann 7 which we visualige ony Plo Jranin§ Problem in the Jorm 0 }—_and__theiy interaction ad y ‘ 4 4 ‘ ‘ ‘ ' 4 7 7 7 | Somedhing LANG dle ard Conceptual) (Person, School, Howse, vebider) = Hel Some attrieut-es ( Property | State, | aS Sone_actions (Poration/ havior) _ OOM (olf _crented Medel) with | Teacher, Student, Shoe) ha Patents, Clastroem, Play G pret pg Jlowd Reacher Fe Siac Scanned with CamScann [Draw an COM with the objects’ — School, teachers, Students. OV Coven, Plgiued. |] tees fuanithe, gras, Jlowers, leaes -Teops [School] — AL - P J “fjurded Teac J Teaches AnciPle| her = ag) Plays in Dey Around) * TET L Ty] Boblem Names Schoo) pe en a ee 3x ||}-ln__o4fect_oriented _| (ho graing (OOP), (00P), indormation hiding 'n_ the _obfect details [Side ‘ae MH Principler te achelue inJobmadion Hiding i4_OOP.- |All__ihjormation related > to an object it Stored within obfect. } t Scanned with CamScann alli poh the seeded Can Peed, Follows anteges: - = ene Say ing “ate major advaute ger. se mnanuPullated 44 the object itel 7. || Senpligies cur ohgect_briented — Model (OOM) ere, atlelegadelt chain prop gation. apsulation: > —Tt ol] 44 fate enclated all the chatacterithics ; P07 object in the obgect _ittel?- ——| p= >Lnjormation _hidlng canbe —-" ~ achtoved WO 229 Copsulat ron. 4 te = tz. a % : ——| | Abd yp jefe Al Simplicity € clarity | 4 | datecenitics | Low __complenits [+ hme © Better Uncistendlig ‘| Age | 2 CNIC 7 tine U oe --bfevalions Jp Zaterjace if a itt 0) Junctions | > walle 4 he _weritl te expole 9 Lalt with_offer oLfects. pg Sleeps - Scanned with CamScann mi e. ‘de __ ee = wh. erate ceo Cat —$ Tilertae ah Mobile Whee (Steat) | Mund er( Input /dial) = Gear (Charge) : : Call (Make /Ditcome ct) Accelerlor I Mo on adtesr book (Add/tonou Light S(T (Turn_onfo}) } Murber (Change Remove) — — | Breaks ( apply ) pn ___||_ Eaplementation: ——E—E——————— tual implementation o}. haunt oan object in__obfect _ Ofiented programing aa o. two Parts. ‘structure ( Physically look) Pantin (Mech ajiSen) Mescage: . Masago though a mesiage _b4 involving appro, rinkee_opekation__th__the target Objects. e.9. scanned witn Camscanin —=\— | Abstraction: | Abstraction is a way ay to Cope pe( Mi imine) with — 1 Complevity and jt i _Wled to Bing lit— thingy fe jp Piineipler ‘09 Abstyaction: 1 Captte only thote details an object thal 7 a clive(Poin no) view). amples atttehescsuy’ teh 4 Mi is @ PHD _S: ae es BS students | Coord Aiibates, 7 Student Name, Age, Study pas dapie haine, Reno, (NEC. 4 CGPA. 4 lame, Age, CNC, Salary, Dekighatton, Quy jon, 4 Enpleqee DD 4 Overall Operations. { 4 Stldeyf= Study, Give_enans, Give_Presentation- Teacher Teach, Take exans, Take presentation, Evaluation. scanned with vamscann Class: 4 Tl AW objects 0) Some» bind _ewsdit identical Similey)_ —— cherctnttet (etn ation Steet 4 Bchauiours) Hawever, ey Fave date of thei. OWh» Reprefentation CAL name ' Altrbides i oe | : 5 Sup: mn. ee gi is Normal Form, | A child inherit choacterictict - From it patents gde inherited _chamctevistice, ______— A child. md hate__it!S. own: unique —oltyibutes. — Tt _if ied Ae To__awoi plication TE Re-ueability | a “4 Scanned with CamScann | Person _ gl) _ Name _ iT — 8G re — _ — CTC se _ «Sleep - _ «Lat ae _ —_____| co oo Teacher Doctor | Student | f. 2G 2 Savy |—-Degree rtame | —___] jr Ene Td| | .£mployeetd ||, ct eae a - |. Delignation + Speciabizatio Roll no | |] | delever-lectuel check-4 }Sassé _ || fraistady | | -Take-tuams| |, Preceribe Ge Bape |_. Evaluate C Operate Give Presehtetinn| x 4 Clase Student Scanned with CamScann $ t Private: char names es Ploat_Marks, ink Rol nro" Publics vojd Inpuk () PE cout ce" Enter Your naines* 3 Coupee" Cihss Name; Cout-2e"Exter Your Roll_wor"s ind» Roll vo; coukze" Enter Your marks:"5 Cinss Marks 5 void. _disploal); aa © coutee"" oy entered name2" é¢ Name; Cout-ce" You entered Roll_nax" 2c Roll vo; couk-ce" You entered Marks=" << Mares s Scanned with CamScann void maint) | clrecr()s |__ Student, , 621 $3) Suis S.+ Input); scanned witn Gamscann |Fanction: a noe _ Block 7 code. Per parm Some action when jt We called by 1 name. i 7 L Stutaxs Return type Funelion nidne(Petansters) which ind_07 cup __Uset-cleperdert _Arfiuments - will be Provided by Tie_vilues cohich —_____unetion.e-g (void, id, ___________ate Pass by —____ Ploatt, char). - —F_unction. _ a Pass bg vane) a Pats bY Fe Perence) ____Thitialization I] write “4 progran that —inpuds tun hunbers prom uley € cahuclate it's Sum wir 1g _purclion. —__ 6 Bincludeciptreamhs _ os] indee Cohiohs |] brie Sain (ind 144 Y) > Fora) Darahetery ona Scanned with CamScann }——Swreaths |—_Couter "Sum is= "22 Sn, | void man Coutze "Enter two numbers"; Cin dSasshs Sam 4) a Actual parameters ZEurction cab Jeter; fF oo bdrite Program that inputs _namesroll nunbes, class, | Subject £ marks From uber. Display thele_valueh ding _, on, = yj _ _ Hinclude cioctiean h Hinclude > Subs cod ek? Eiltr tour maphs:"eeen dls cit > qh Slidest (4a cl, Sub, Roly Ma), ; Yetch() ; 5 “BSS ASSSD*SGOSSSS Scanned with CamScann pJtite a program that —inpuls marks in main Junction ard pasheS _thehe marks toa. Calling Junction. The | purction retutn grade that bo main junction where, ame alipley ed on the Seleen. -Usieg Po lecuil pCritertas | Grade A490 oF hole marks Grade R 80 oF above marks | Grade __C Ho__oy above marke Gide D Sho or above mare Grade lose than 0 mare | #nclede cioSteamhs #inclicle ec Coniohs— _ / char_4ade (tnt_m) — |—-¢—veid_main)__________— ee | nt marks _ = | chay Ay | Colle "Enter_marless! 5 | Cth 5s marke a tecle (marks) getch() - « no nan nn ze StlUctlemUlUlCcleUlCelClelClClf scanned with vamscann ik (as 9) ele i+: (qs 20) yetUth 'B': eke i} (a> 20) teturn C's ele i} (a3) yeturn 'D'; else retry 'F'; — Scanned with CamScann

You might also like