Docsity

Object Oriented Programming, Summaries of Object Oriented Programming

Partial preview of the text

Download Object Oriented Programming and more Summaries Object Oriented Programming in PDF only on Docsity!

—Dloreck Oriented 3 Eagrnctring. ts ie a4 ff Date See SE ca 7 _Declovalen of \nwlables fx Cit at AN Yrtegers (Syntax => ink 4vorlable Neme>s) HS Se tt num s —r(nom vorlable decloves as indegor ram 5 int nome 48 —>{nase varlable dealored as ‘nteaerdala- lupe anal _fualJeed dik a Walods) 2) Double [Ploat : (oprrax => double s) tots damien tlh ‘we Aalle datliaith ia \ dubls di N double num 25+425 —>lnum verlable declared as OR dabelype ond Inthablced sihh Lloat nome 1449s en | L | 3) Shdnat [Spon = ohring ) ali. pts name + Slain voviable declared os sting dolla) u ohag name = George”; —> (name variable dedarsl aiden hi dalalype and IntHalizced wilh a sling jalne 5 4) Boolean: (Suntan 2 boal evarlable. Name >) : eqs- nat found »—>l Pound vorlable declared a& boolean dalobye, bool fond Falves ol Cora ds) vewlable deoloved as nals datalupe ond intHelzed wha beoleah aaltai’ : Fae loypbas => shar eliarlable _Nome>s .) eg: ater ch 4 leh verlable declared a Choma dale) S Biser the hs ool dh terighild dedarell as ‘dumaber doetype and THallzedt wih a value.) ics) CamScanner caer ron en Liput /Oobpot dlabemerts fa __CHee 1) Ott blalemeats Dyahax => Console» WrileLine (ceblput AL chemaat » "hi eq $= Console -Writeline (“Buber Your Nome + il ); 2) Trpok dhatement + | Syaten => Console: Readtne ()s J ads € ~ TWEE ae ComerhsTeBt3) (Console Readlne ())5 | TF alt Fake user input | Basleally fi CHE whenever user input’s the dole fs | dlwaus i) in shina Poke _whial, hos te be Converted ete VCerbeln dali lipe for Prowam to Process It Par Me H Luncbtonabaty » Por Lis. 4 we Use 3, - built funotons for Ye Vite take Place - Conmersion pes of Commersion t- 1 - [Dypden = Conmart Toft 3205) is . nya Yateger Y eas q fet ne Convert. TeTut32, ( Console’ Readbne))s ¥ J Gumert iF tio 32 We) iF lth take oe hepott T : 39 tilb « 4 byte Aloo Can be Comer TePdt6 (2 bile) ond Cowerd-ToBul6u (8 byte). ics) CamScanner I gg 4) Beolean : Sunbax a> q bool» Try Parse ()s Cinundests Bealear O; | aie q bool Bund = bool «Try Rowse LPonenle ‘ Read Line ); | bool found = ChnitrboTh Waa least ( Connals ReadLine ¢))s 5) Chovagters | bynbas => Convert Toho l Ys | _@g t- N Bae gh i Cited TTathart Cinsale feat (da | Nerlable’s Thbue Hroveh Oukput dheabement : 2g :- Vet num 218 y numb. 253 Prod £4305 : | Console. Writel mel “fo * £4] . F2q ie num 4 nomi Prod 4 ie oe | Output => 18 * 25-430 | LProase -roml fs nat kept euch Ulte | Congole-Wwiteline (“Fol * £4} » £2} "jnumy 4 Prod) Oulpot eat 18 5 = 430 =P would - ovtpul as emply as none of He value js leept 40 PE would ‘be kept blank on Ovtput _Sereen. ics) CamScanner I gt Readline (\ —> 2 wilh bave_the Expo ic of Shing: ReadlY—> PE will Save the Prput’s Cirst teller af “String oc Number th tewn of Prteger. Readkeul) ‘ae 2 PN Peusels Weare execsHon onl US Gr \ Presseh A Yet and ratums YDormatton ihauk _the kot Pressed « Access Med) Mers 1) Pole —> The Puble modi Mer sels ho _vestrialon on the access of data Members amd Member fang bons leas Public nee villi &.) 2) Private —> The PWvate MediMer els veslicHon on the aacess of fs dala plombers and’ Member PunoHons - leas ohing Asenes i) 3) Protected —> The Proteched Modifer sels tame reshlelln buch Uke those declared wi Lh rs can be accessed only tuto Uely Child lass ‘not on oiher sats Lege! Prstiuded’ hae chil ProperHes t- 1) Read Only * 2 Weibel Ont! X Pead /write ynba.e => eee Modifier> edalobupe > Atorlalle Name > qet E velurn zverlable Name val bet F everlable Name> > values] J 2) Durameterlzedt Constructor : Value’s te the dala Member ; ere dstlaneck dh veuah Pera née, t t2) FE Cant luda be ian \ | eae: | N class Dhope { E ink Len lel pubis Shape (tut Len ink wld) Len 2 len 3 Ponaimelertzed ill » Wid s Construchor! j slate old Maln CS f Shape ohp > new bhope (8 3). ao peepee peeps (este Read hey en Juntax «> Poblle 2 class Nome» ededalyper4 q adalabipe esol adobe, Neme>) ; E edale Member> = 4 edala Member 2 evarlable Name 24 1 AlaHe ovlables + They ore the varlables not deDied by thelr hamthy means that lala deesnt. men Mat value Inte ony varlable would not chonaes PE will Change and When We _ Beawat Po exouted ae shore We updabedk value not phe bballzed on- buntow => q ohete cvarlable Name > eas fae World bleHe fnt num: O pee volo Drovemend () _ num: 49 3 PubUe volal - display () gpnetalte Wel leLIne [gim’) 5 1 piste vold Main (\ World P = new World); D. ProvemenH) 3 D. displays World. py = new Worth C)s Pt display (5 J * Date Oulput: 109 Alexanclev- es Dea Pa el Soar Una It es Oo Date \ i i | im Pillars of Obrect Oriented. Programming t- 1) Eneapoulalton : Ph an Mechanlom fn which data member and Method (Member fencHons) 2% nwa pped fn a Sak uit inside a class 550 that the data fs at . behiq accessed by other class. Basea bly hn Simple a EE Slagle Copule all ‘Ihe daha Member | and Mebhed (Menbor Punalion) se _endlosed « Slavs bludand a shina name § int Ga. Pablo _Sludent LY f name eas DePaul} Constructor ids 1298 5 ‘ q 4 poe vald Display a) : | Crapale Wabelne (“dhudek: i hamte det! achama )e | Crrsate’s hiibel ne (* bludent 2) fo + re 1d); eles vol Main) blodent 54 = new dudes y—robgect Crealed of beat it: ‘Display L)5 ass] ics) CamScanner ple Parle Lme Bmployee i Bmaplayce Z gg i Vol Ndi Baglnyce Debeals Console -WeileLIne (“the Buplouee Nome fo ¢ + viameés) Console- Wetteline CThe Broce bred Hours ave 2" rhb aa val Matn () Bnplouee Bi = new Bmplouee O; By-Name 2 “ler”, —albelber Ei. worknghour = ¥s “tp| haber’ £4. Briplosce Delailsl)s Part» Lime Bgloyec 22 = new Par Hime Bruplayee Ds 5/4 B2.- Name =" ‘Faaktson”s —>(debter) #)- worlUng hour 2 5s —(Sebter) £). Part Wne Buplowee Delailsd) Console + Readltey (35 5 Pal Morphin: Tt tb a techalgve rie which we Con _ullUze | a Hngle nawied — fimotton ‘Pr many ‘other clasts | get \ changng ths RETR Fa nabuve H but dU fforent Bighalove u Date _. Gg 3 We. on Animal shying Animal. Name § Abus vaing onlmalname get bevlirn Asinal Nest § ] ok F AntmabName = valve « 4 ] Pelt deluslueld tend.) Connate hi beline (YntmalNome + “Sounds? Meaw Meow dy sce ts nies Snes SUR (eee es class Det 2 Animal E q PubUe override wold Seund. () Console, Wri lel ine (ArtmalNome + Sounds ‘Ulte: Wook ool h, ] ben dlettslalt vold Main L) Animal AL - new Liesl Al -animalnome » “Cat”, At: Sound Os Noa AD = New Deg ls _ 2: lonlmal name « bog os A2- Sound (5 Dete ~pletts veld _Malnl) Rechangle R= news Rechangle (4-25 , 5)s R. Calcvtatedven (Ys ; Console. Wy) belive Aven of Padang So "FER Cabeulateren Nk greet e-Readker ls | How bo Create obrec \n CFF: eclass Ndme>rcooreat Names = new eclass Name>l)s & Shaded 5 onen dludentl)s > DeDewlt Cpnebrudlor wiU. be cabled Pret). Te fe Consist of Rralnelerzed Consbructor: " Biaicd bs ni blodent(‘ithert”, 9620 4 soon Nona Pal-Ne hes Structures tn CHE: Ys a value type dada dShoclove that Broa poulates Py Colleoton of Pelated dale Member and can abso tnolude foncHon members Ulte Mebhacls » Constructor and ProperH es Lynton => Publ bbuct | édala Member: 4 | a l } m hers s Pbk breotat be Pstottet em H bUc eshuchve Names kfarameber 12,2 Parameter 2>) dade Members = eduwameler 4 >s edala Member2> 2 2 Porameter 22's J J | care pel otal Shelent ' Public ft Pls | Public hres Name + 4 i Publle frat thee 5 pile bhadientl hie i 4 bring nome 4 int age) VY) = fds Name Zz RamMe 4 hae 2 ages is} : i ni “List In Ct: nbax = | a Liot ( chorogter «new Ltsbechor> (Ss L list wih 946 Capnolly [Renae Lea q eas 4 Liskefnb> number = new Hobe b> (45) 5 i egt V tok echaw> chovapler = new [htwehors (44) 5 | | Probe }o}ng |B abehng valves to Lio ts eas f NV Dskelnts numbers enon [sb chd-s E142, 3BoFa49 294514 C94 y Letechar> choragler = new Liskechar> t's? RSAQOATIAII ne 5 Lest of Obgects fh C+: inamespace Bank AecouxtApps | pp class BankAccount public shring owner I qet 3 gek 3 public Gutd” AccountNumber fgets sets J public decimal Balance ba ef; bets | 4 J public pactial class Form 4 + Fon | publi Forall) E Tafttab ies Component ()s BankAecount hank Aecount = new Rank Account): bonkAecount + OWnNeY 2 °F oowe. 4 bankAecount + ocountNumber= Guid - NewGurde’ bankfccont Balance = 2503 Ranlifccaunt banlthecourntd= nes Bank Account) + banMecount! - owners damte"'s banleAccourt4 » AecountNumber = Guid New Guid )3 bankAccount4: Balance = 9998 ; Bankfccaunt bank frecsmf2 2 new Bank Aecount()s bank Account2- owner= “Bells bankAecount2. ecourtNumbers Gutd- New@uid) s | bank Account? Balances 150; ics) CamScanner