oop’s
TRANSCRIPT
![Page 1: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/1.jpg)
OOPOOPObject Oriented ProgrammingObject Oriented Programming
By : Tauseef Ahmad (107)
![Page 2: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/2.jpg)
Evolution of OOPEvolution of OOP
1,0
Machine LanguageAssembly LanguageProcedure-Oriented
Object-Oriented Programming
![Page 3: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/3.jpg)
Procedure-OrientedProcedure-Oriented
• The primary focus is on functions.
• It basically consist of list of instructions for computer to follow, and to organize these instructions into groups known as functions.
![Page 4: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/4.jpg)
Structure of POPStructure of POP[Procedure oriented programming][Procedure oriented programming]
Main Program
Function-1 Function-2 Function-3
Function-4 Function-5
Function-6 Function-7 Function-8
![Page 5: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/5.jpg)
Drawbacks of POPDrawbacks of POP• Most of the function share global data.
• It does not model real world problem very well.
Global data Global data
Function-1 Function-1 Function-1
Local Data Local Data Local Data
![Page 6: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/6.jpg)
Object-Oriented Object-Oriented LanguagesLanguages
• Object-oriented programming is not the right of any particular language.
• Like structured programming, OOP concept can be implemented using any language like C and Pascal.
![Page 7: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/7.jpg)
Object-Oriented Object-Oriented ParadigmParadigm
• Object-oriented programming (OOP) is a programming paradigm that uses "Objects" and their interactions to design applications and computer programs.
• Everything around us are objects interacting with each others.
• Each object has a set of features, including adjectives and verbs.
• Object-oriented paradigms is sometimes thought to be a simulation of the real-world around us, which make it the paradigm of choice for most application domains: GUIs, games, business, etc.
![Page 8: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/8.jpg)
Basic concepts of OOPBasic concepts of OOP• Objects• Classes• Data Abstraction and Encapsulation• Inheritance• Polymorphism• Dynamic Binding• Message Passing
![Page 9: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/9.jpg)
ObjectsObjects• Objects are the run-time entities.• It may represent a person, a place, a bank
account, a table of data or any item.• Objects take up space in the memory and have
an associated address like a structure in c.• Some examples : car, man, woman etc
![Page 10: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/10.jpg)
ClassesClasses• A class is an abstract definition of an object.
• Defines how would the object look like when created.
• Think of classes like the patents of actual inventions.
![Page 11: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/11.jpg)
EncapsulationEncapsulation• Wrapping up of data and functions into a single
unit is known as Encapsulation.• Encapsulation is hiding the functional details from
the 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.
![Page 12: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/12.jpg)
Data AbstractionData Abstraction• Abstraction refers to the act of representing
essential features without including the background details or explanation.
• An abstraction is a form of representation that includes only what is useful or interesting from a particular viewpoint.
• Example : A map is an abstract representation, since no map shows every detail of the territory it covers
![Page 13: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/13.jpg)
InheritanceInheritance• Inheritance is the process by which objects of one
class acquire the properties of objects of another class.
namephoneNumberaddresshourlyWage
WageContract()CalculateTax()PayTuition()DropCourse()
Professor
namephoneNumberaddresssalary
TeachCourse()CalculateTax()DevelopCourse()
OR
Employee
namephoneNumberaddress
CalculateTax()
SupportStaff Professor
TeachCourse()DevelopCourse()
salary
Subclasses
WageContract()
hourlyWage
SupportStaff
![Page 14: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/14.jpg)
InheritanceInheritance
Man
Suzuki
WomanBMW
Car Human
![Page 15: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/15.jpg)
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
![Page 16: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/16.jpg)
PolymorphismPolymorphism• Polymorphism is a Greek term means the ability
to take more than one form.
Shape
Draw()
Circle Object
Draw (circle)
Box Object
Draw (box)
Triangle Object
Draw (triangle)
![Page 17: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/17.jpg)
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 via messages.
![Page 18: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/18.jpg)
18
Object and Their Object and Their InteractionInteraction
Program
![Page 19: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/19.jpg)
19
Object and Their Object and Their InteractionInteraction
Program
Tom, hold your sweep!
![Page 20: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/20.jpg)
20
Object and Their Object and Their InteractionInteraction
Program
Tom, hold your sweep!
Tom, beat jerry!
![Page 21: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/21.jpg)
21
Object and Their Object and Their InteractionInteraction
Program
Tom.holdYourSweep()
Tom.BeatJerry()
IN PROGRAMMING
![Page 22: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/22.jpg)
22
Object and Their Object and Their InteractionInteraction
Program
Tom.holdYourSweep()
Tom.BeatJerry()
IN PROGRAMMING
message
![Page 23: Oop’s](https://reader035.vdocument.in/reader035/viewer/2022062704/55635a02d8b42aed538b547b/html5/thumbnails/23.jpg)
23
Object and Their Object and Their InteractionInteraction
Program
Tom.holdYourSweep()
Tom.BeatJerry()
IN PROGRAMMING
message
message