×
You can use excuses to convince others, but how will you convince yourself?
--Your friends at LectureNotes
Close

Object Oriented Programming Using Cpp

by Sarmi SasirekhaSarmi Sasirekha
Type: NoteOffline Downloads: 99Views: 2508Uploaded: 1 year ago

Share it with your friends

Suggested Materials

Leave your Comments

Contributors

Sarmi Sasirekha
Sarmi Sasirekha
NOTES​ ​FOR​ ​C++​ ​LANGUAGE​ ​PART​ ​1 What​ ​do​ ​you​ ​mean​ ​by​ ​Object​ ​oriented​ ​programming/what​ ​is​ ​object​ ​oriented programming? Object​ ​oriented​ ​programming​ ​popularly​ ​called​ ​oops​ ​is​ ​a​ ​programming​ ​paradigm.​ ​It uses​ ​software​ ​engineering​ ​tools​ ​which​ ​can​ ​be​ ​used​ ​to​ ​build​ ​more​ ​reliable​ ​and reusable​ ​software​ ​system.​ ​One​ ​more​ ​programming​ ​paradigm​ ​which​ ​is​ ​known​ ​as structured​ ​programming​ ​has​ ​proved​ ​its​ ​utility​ ​in​ ​software​ ​field.​ ​Now​ ​the​ ​trend is​ ​changing,​ ​more​ ​and​ ​more​ ​programmers​ ​are​ ​using​ ​oops​ ​as​ ​new​ ​paradigm. In​ ​brief​ ​we​ ​can​ ​state​ ​that​ ​in​ ​oops​ ​we​ ​give​ ​due​ ​importance​ ​to​ ​data​ ​and​ ​as​ ​well​ ​as function.​ ​Oops​ ​views​ ​data​ ​and​ ​functions​ ​as​ ​single​ ​entity.​ ​The​ ​object​ ​oriented programming​ ​means​ ​that​ ​our​ ​program​ ​will​ ​consist​ ​of​ ​one​ ​or​ ​more​ ​objects​ ​these objects​ ​in​ ​turn​ ​communicate​ ​among​ ​them​ ​using​ ​predefined​ ​functions​ ​and​ ​complete the​ ​task. Why​ ​do​ ​we​ ​need​ ​object​ ​oriented​ ​paradigm? We​ ​need​ ​object​ ​oriented​ ​programming​ ​paradigm​ ​because: 1.​ ​Cost​ ​of​ ​high​ ​speed​ ​computing​ ​system​ ​is​ ​decreasing​ ​but​ ​the​ ​cost​ ​of​ ​development of​ ​highly​ ​efficient​ ​operating​ ​system​ ​and​ ​application​ ​software​ ​are​ ​not​ ​going​ ​down. In​ ​order​ ​to​ ​reduce​ ​the​ ​cost​ ​of​ ​development​ ​of​ ​efficient​ ​operating​ ​system​ ​and application​ ​software​ ​new​ ​programming​ ​paradigm​ ​is​ ​necessary​ ​and​ ​oops​ ​can​ ​play​ ​its
important​ ​role​ ​in​ ​this​ ​scenarios. 2.​ ​As​ ​the​ ​no.​ ​of​ ​users​ ​of​ ​computers​ ​is​ ​increasing​ ​the​ ​requirements​ ​of​ ​software are​ ​also​ ​increasing​ ​but​ ​the​ ​actual​ ​rate​ ​of​ ​software​ ​development​ ​growth​ ​is​ ​slow. To​ ​boost​ ​the​ ​rate​ ​of​ ​growth​ ​of​ ​new​ ​software​ ​development​ ​growth​ ​new​ ​programming paradigm​ ​oops​ ​is​ ​necessary. 3.​ ​Cost​ ​of​ ​software​ ​maintenance​ ​of​ ​older​ ​programs​ ​which​ ​were​ ​prepared​ ​using older​ ​programming​ ​paradigm​ ​is​ ​high.​ ​By​ ​software​ ​maintenance​ ​we​ ​mean​ ​that​ ​process of​ ​modifying​ ​or​ ​extending​ ​capabilities​ ​of​ ​existing​ ​software​ ​which​ ​requires​ ​deep knowledge​ ​and​ ​understanding​ ​of​ ​existing​ ​software.​ ​To​ ​reduce​ ​cost​ ​of​ ​software maintenance​ ​new​ ​programming​ ​paradigm​ ​oops​ ​becomes​ ​necessary. What​ ​are​ ​the​ ​advantages/benefits​ ​of​ ​oop​ ​and​ ​demerits/disadvantages​ ​of​ ​oops? Merits​ ​of​ ​oops 1.​ ​oop​ ​provides​ ​a​ ​programming​ ​approach​ ​which​ ​nearer​ ​to​ ​the​ ​real​ ​world​ ​problems. 2.​ ​oop​ ​protects​ ​the​ ​data​ ​from​ ​the​ ​illegal​ ​access.​ ​Data​ ​is​ ​a​ ​crucial​ ​element​ ​of programming 3.​ ​oop​ ​divides​ ​the​ ​whole​ ​problem​ ​in​ ​the​ ​form​ ​of​ ​calls​ ​and​ ​object. 4.​ ​Inheritance​ ​gives​ ​the​ ​reusability​ ​of​ ​code​ ​that​ ​keeps​ ​limitation​ ​the​ ​length​ ​of the​ ​code​ ​and​ ​that​ ​eliminates​ ​the​ ​redundancy​ ​of​ ​code.
5.​ ​Multiple​ ​instances​ ​of​ ​the​ ​object​ ​can​ ​be​ ​used​ ​in​ ​program​ ​without​ ​any interference. 6.​ ​Actual​ ​problem​ ​can​ ​designed​ ​on​ ​the​ ​basis​ ​of​ ​objects. 7.​ ​Object​ ​oriented​ ​system​ ​can​ ​be​ ​easily​ ​upgraded​ ​from​ ​small​ ​to​ ​large​ ​system without​ ​any​ ​change​ ​in​ ​the​ ​internal​ ​architecture​ ​of​ ​the​ ​software. 8.​ ​Object​ ​oriented​ ​enables​ ​the​ ​use​ ​of​ ​same​ ​property​ ​in​ ​the​ ​different​ ​way​ ​by defining​ ​external​ ​definition​ ​of​ ​same​ ​internal​ ​definition. 9.​ ​Message​ ​passing​ ​gives​ ​a​ ​better​ ​communication​ ​technique​ ​among​ ​the​ ​objects. 10.​ ​Software​ ​complexity​ ​can​ ​be​ ​easily​ ​managed. Demerits​ ​of​ ​oops: 1.​ ​Oops​ ​puts​ ​compiler​ ​overhead​ ​(that​ ​is​ ​extra​ ​processing​ ​time​ ​of​ ​CPU​ ​is​ ​required). 2.​ ​Object​ ​persistency​ ​is​ ​possible​ ​to​ ​manage​ ​using​ ​file​ ​handling​ ​and​ ​data​ ​base. 3.​ ​Re-​ ​orientation​ ​of​ ​software​ ​developer​ ​to​ ​object​ ​oriented​ ​thinking​ ​requires effort,​ ​time​ ​mastery​ ​over​ ​software​ ​engineering​ ​and​ ​programming​ ​methodologies. 4.​ ​Code​ ​reusability​ ​is​ ​not​ ​much​ ​easy​ ​to​ ​achieve. 5.​ ​The​ ​message​ ​passing​ ​between​ ​many​ ​objects​ ​in​ ​a​ ​complex​ ​application​ ​can​ ​be
difficult​ ​to​ ​trace​ ​and​ ​debug. 6.​ ​Benefits​ ​only​ ​in​ ​long​ ​run​ ​while​ ​managing​ ​large​ ​software​ ​projects,​ ​at​ ​least moderately​ ​large​ ​one. What​ ​are​ ​the​ ​characteristics/important​ ​features​ ​of​ ​oops/what​ ​is​ ​the​ ​object oriented​ ​approach/​ ​what​ ​are​ ​the​ ​oops​ ​view​ ​points? In​ ​brief​ ​we​ ​can​ ​state​ ​that​ ​in​ ​oops​ ​we​ ​give​ ​due​ ​importance​ ​to​ ​data​ ​and​ ​as​ ​well​ ​as function.​ ​Oops​ ​views​ ​data​ ​and​ ​functions​ ​as​ ​single​ ​entity.​ ​The​ ​object​ ​oriented programming​ ​means​ ​that​ ​our​ ​program​ ​will​ ​consist​ ​of​ ​one​ ​or​ ​more​ ​objects​ ​these objects​ ​in​ ​turn​ ​communicate​ ​among​ ​them​ ​using​ ​predefined​ ​functions​ ​and​ ​complete the​ ​task. 1.​ ​Emphasis​ ​on​ ​data​ ​rather​ ​then​ ​the​ ​logic​ ​or​ ​procedure. Oops​ ​pays​ ​due​ ​importance​ ​to​ ​data​ ​which​ ​was​ ​given​ ​secondary​ ​importance​ ​in​ ​other programming​ ​paradigm.​ ​In​ ​oops​ ​program​ ​is​ ​designed​ ​around​ ​data​ ​and​ ​not​ ​designed around​ ​function​ ​which​ ​operates​ ​on​ ​data. 2.​ ​whole​ ​program​ ​is​ ​divided​ ​into​ ​useable​ ​entities​ ​called​ ​objects. 3.​ ​it​ ​creates​ ​the​ ​abstract​ ​data​ ​type. 4.​ ​a​ ​data​ ​structure​ ​is​ ​used​ ​to​ ​provide​ ​the​ ​complete​ ​characteristics​ ​of​ ​the objects.

Lecture Notes