Uploaded on


  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On Slideshare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. OOPOOPObject Oriented ProgrammingObject Oriented ProgrammingBy : Tauseef Ahmad (107)
  • 2. Evolution of OOPEvolution of OOP1,0Machine LanguageAssembly LanguageProcedure-OrientedObject-Oriented Programming
  • 3. Procedure-OrientedProcedure-Oriented• The primary focus is on functions.• It basically consist of list of instructions for computerto follow, and to organize these instructions intogroups known as functions.
  • 4. Structure of POPStructure of POP[Procedure oriented programming][Procedure oriented programming]Main ProgramFunction-1 Function-2 Function-3Function-4 Function-5Function-6 Function-7 Function-8
  • 5. Drawbacks of POPDrawbacks of POP• Most of the function share global data.• It does not model real world problem very well.Global data Global dataFunction-1 Function-1 Function-1Local Data Local Data Local Data
  • 6. Object-Oriented LanguagesObject-Oriented Languages• Object-oriented programming is not the right of anyparticular language.• Like structured programming, OOP concept can beimplemented using any language like C andPascal.
  • 7. Object-Oriented ParadigmObject-Oriented Paradigm• Object-oriented programming (OOP) is aprogramming paradigm that uses "Objects" andtheir interactions to design applications andcomputer programs.• Everything around us are objects interacting witheach others.• Each object has a set of features, includingadjectives and verbs.• Object-oriented paradigms is sometimes thought tobe a simulation of the real-world around us, whichmake it the paradigm of choice for mostapplication domains: GUIs, games, business, etc.
  • 8. Basic concepts of OOPBasic concepts of OOP• Objects• Classes• Data Abstraction and Encapsulation• Inheritance• Polymorphism• Dynamic Binding• Message Passing
  • 9. ObjectsObjects• Objects are the run-time entities.• It may represent a person, a place, a bankaccount, a table of data or any item.• Objects take up space in the memory and have anassociated address like a structure in c.• Some examples : car, man, woman etc
  • 10. ClassesClasses• A class is an abstract definition of an object.• Defines how would the object look like whencreated.• Think of classes like the patents of actual inventions.
  • 11. EncapsulationEncapsulation• Wrapping up of data and functions into a single unitis known as Encapsulation.• Encapsulation is hiding the functional details fromthe object calling it.• Can you drive a car?o Yes, I can!• So, how does acceleration work?o Huh?• Details encapsulated (hidden) from the driver.
  • 12. Data AbstractionData Abstraction• Abstraction refers to the act of representingessential features without including the backgrounddetails or explanation.• An abstraction is a form of representation thatincludes only what is useful or interesting from aparticular viewpoint.• Example : A map is an abstract representation,since no map shows every detail of the territory itcovers
  • 13. InheritanceInheritance• Inheritance is the process by which objects of oneclass acquire the properties of objects of anotherclass.namephoneNumberaddresshourlyWageWageContract()CalculateTax()PayTuition()DropCourse()ProfessornamephoneNumberaddresssalaryTeachCourse()CalculateTax()DevelopCourse()OREmployeenamephoneNumberaddressCalculateTax()SupportStaff ProfessorTeachCourse()DevelopCourse()salarySubclassesWageContract()hourlyWageSupportStaff
  • 14. InheritanceInheritanceManSuzukiWomanBMWCar Human
  • 15. PolymorphismPolymorphismint add(int a, int b, int c){return (a+b+c); It will return addition} of 3 integer numbersint add(int a,int b){return (a+b); It will return addition} of 2 integer numbersfloat add(float a, float b, float c){return (a+b+c); It will return addition} of 3 float numbers
  • 16. PolymorphismPolymorphism• Polymorphism is a Greek term means the ability totake more than one form.ShapeDraw()Circle ObjectDraw (circle)Box ObjectDraw (box)Triangle ObjectDraw (triangle)
  • 17. Message PassingMessage Passing• The process by which an object:o Sends data to another object.o Asks the other object to invoke a method.• In other words, objects talk to each others viamessages.
  • 18. 18Object and Their InteractionObject and Their InteractionProgram
  • 19. 19Object and Their InteractionObject and Their InteractionProgramTom, hold your sweep!
  • 20. 20Object and Their InteractionObject and Their InteractionProgramTom, hold your sweep!Tom, beat jerry!
  • 21. 21Object and Their InteractionObject and Their InteractionProgramTom.holdYourSweep()Tom.BeatJerry()IN PROGRAMMING
  • 22. 22Object and Their InteractionObject and Their InteractionProgramTom.holdYourSweep()Tom.BeatJerry()IN PROGRAMMINGmessage
  • 23. 23Object and Their InteractionObject and Their InteractionProgramTom.holdYourSweep()Tom.BeatJerry()IN PROGRAMMINGmessagemessage