SlideShare a Scribd company logo
OBJECT ORIENTED
PROGRAMMING
Introduction
REFERENCE MATERIAL
 Textbook:
 C How to program by Paul Detiel and Harvey
Detial, Prentice Hall; 10th edition (March 4, 2017)
 Reference Books:
 The C++ Programming Language, 4th Edition by
Bjarne Stroustrup
 The C++ Programming Language, 4th Edition 4th
Edition by Bjarne Stroustrup, Adison-Wesley
Professional
 Jumping into C++ by Alex Allian,
Cprograming.com
WHAT IS OOP?
 Object Oriented Programming is a programming
technique in which programs are written on basis
of objects.
 Object is a collection of data and function
 Object represent a person, place or thing in real
world.
 In OOP data and all possible function on data are
grouped together.
WHAT IS OOP?
 Object Oriented Programming is a programming
style that is associated with the concept of class,
Objects and various other concepts revolving
around these two, like inheritance,
polymorphism, abstraction, encapsulation.
EXAMPLE
 A fork is an object with properties
 a number of prongs
 its size
 material (made of plastic or metal), etc.
 Behavior and functions of a fork include
 Shredding
 Squashing
 Making design
 Eating.
3
EXAMPLE
Fork
WHY OOP IS NECESSARY ?
 The OOP (Object Oriented Programming)
approach is most commonly used approach now a
days.
 OOP is being used for designing large and
complex applications.
 The earlier approaches to programming were not
that good, and there were several limitations as
well.
EVOLUTION OF OO
PROGRAMING
 These programming approaches have been
passing through revolutionary phases just like
computer hardware.
Machine
Language
Monolithic
Approach
Procedural
Approach
Structural
Approach
OOP
EVOLUTION OF OO
PROGRAMING
 Machine Language
 for designing small and simple programs
 Monolithic Programming Approach
 the program consists of sequence of statements that
modify data.
 code is duplicated each time because there is no
support for the function.
 data is not fully protected as it can be accessed from
any portion of the program.
 programming languages include ASSEMBLY and
BASIC.
EVOLUTION OF OO
PROGRAMING
 Procedural Programming Approach
 Program is divided into functions that perform a
specific task.
 Data is global and all the functions can access the
global data.
 This approach avoids repetition of code which is the
main drawback of Monolithic Approach.
 Enabled us to write larger and hundred lines of code
EVOLUTION OF OO
PROGRAMING
 Structured Programming Approach
 divide a program in functions and modules.
 The use of modules and functions makes the program
more understandable.
 It helps to write cleaner code and helps to maintain
control over each function.
 Developed for designing medium sized programs.
 The programming languages: PASCAL and C follow
this approach.
EVOLUTION OF OO
PROGRAMING
 Object Oriented Programming Approach
 The basic principal of the OOP approach is to
combine both data and functions so that both can
operate into a single unit. Such a unit is called an
Object.
 This approach secures data also.
 Now a days this approach is used mostly in
applications.
 The programming languages: C++ and JAVA follow
this approach.
OBJECT ORIENTED DESIGN
 Object-oriented design (OOD) is the process of
creating a software system or application
utilizing an object-oriented model.
 This technique permits the creation of a software
solution based on object notion.
 OOD is an implementation of the object-oriented
programming (OOP) paradigm.
OBJECT ORIENTED DESIGN
 In the object-oriented design method, the system
is considered a collection of objects (i.e., entities).
 The state is shared among the objects, and each
object is responsible for its own state data.
 Similar objects form a class.
 In other words, every object belongs to a class.
OBJECT ORIENTED DESIGN
OBJECT ORIENTED DESIGN
 Objects
 An Object can be defined as an entity that has a state
and behavior, or in other words, anything that exists
physically in the world is called an object. It can
represent a dog, a person, a table, etc.
 An object means the combination of data and
programs, which further represent an entity.
OBJECT ORIENTED DESIGN
 Classes
 Class can be defined as a blueprint of the individual
object, attribute and method.
 Method
 Function that describe behavior of class
 Attribute
 Define in class and represents state of object.
OBJECT ORIENTED DESIGN
 Example of class and object
OBJECT ORIENTED DESIGN
 Example of class, method and attributes
OBJECT ORIENTED DESIGN
 Message
 Objects communicate by passing messages.
 Messages contain the name of the requested
operation, and any other action required to complete
the function.
 Messages are frequently implemented through
function calls.
PRINCIPALS OF OOP
 Encapsulation
 Abstraction
 Inheritance
 Polymorphism
PRINCIPALS OF OOP
 Encapsulation
 The wrapping up of data and functions together in a
single unit is known as encapsulation.
 All properties and methods of an object are kept
private and save from other object.
 Encapsulation makes the data non-accessible to the
outside world.
PRINCIPALS OF OOP
 Encapsulation
PRINCIPALS OF OOP
 Abstraction
 Abstraction helps in the data hiding process.
 It helps in displaying the essential features without
showing the details or the functionality to the user.
 It avoids unnecessary information or irrelevant
details and shows only that specific part which the
user wants to see.
PRINCIPALS OF OOP
 Abstraction
PRINCIPALS OF OOP
 Inheritance
 Inheritance is the process in which two classes have
an is-a relationship among each other and objects of
one class acquire properties and features of the other
class.
 The class which inherits the features is known as the
child class, and the class whose features it inherited
is called the parent class.
 For example, Class Vehicle is the parent class, and
Class Bus, Car, and Bike are child classes.
PRINCIPALS OF OOP
 Inheritance
PRINCIPALS OF OOP
 Polymorphism
 Polymorphism means many forms.
 It is a feature that provides a function or an operator
with more than one definition.
 It can be implemented using function overloading,
operator overload, function overriding, virtual
function.
PRINCIPALS OF OOP
 Polymorphism
OBJECT-ORIENTED PROBLEM
SOLVING APPROACH
 Object-oriented problem solving approach is very
similar to the way a human solves daily
problems. It consists of identifying objects and
how to use these objects in the correct sequence
to solve the problem.
OBJECT-ORIENTED PROBLEM
SOLVING APPROACH
 In other words, object-oriented problem solving
can consist of designing objects whose behavior
solves a specific problem. A message to an object
causes it to perform its operations and solve its
part of the problem.
OBJECT-ORIENTED PROBLEM
SOLVING APPROACH
 The object-oriented problem solving approach, in
general, can be divided into following steps. They
are:
1. Understanding the problem
2. Formulating a model
3. Developing an algorithm
4. Writing a subsequent program
5. Testing and improving the program
6. Evaluating the solution.
OBJECT-ORIENTED PROBLEM
SOLVING APPROACH
 Understanding the problem
The question has asked to find the mean
of all the given grades of a student
OBJECT-ORIENTED PROBLEM
SOLVING APPROACH
 Formulating a model
Average = grade1 + grade2 + …. + gradeN
number of records
OBJECT-ORIENTED PROBLEM
SOLVING APPROACH
 Developing an algorithm
grades_array = grades,
sum=0
for grade in grade array
add grades -> sum
average <- sum / length(grades_array)
OBJECT-ORIENTED PROBLEM
SOLVING APPROACH
 Writing a subsequent program
A program is written following the above
algorithm in the programming language
of choice.
OBJECT-ORIENTED PROBLEM
SOLVING APPROACH
 Testing and improving the program
The program is tested against all kinds of
data including but not limited to corner
cases that may break the algorithm such
as the length of the array being returned
as 0.
OBJECT-ORIENTED PROBLEM
SOLVING APPROACH
 Evaluating the solution
The solution is evaluated and checked
whether the output is correct or not.
PROS OF OOP
 Secure
 Reusability
 High productivity
 Reduce redundancy
 Low-cost development
 Easy to maintain and modify
 Allows for parallel development.
DRAWBACKS OF OOP
 Complexity
 Hardware Constraints
 Size is larger than other programs
 It required a lot of effort to create
 It is slower than other programs
 It is not suitable for some sorts of problems
 It takes time to get used to it.

More Related Content

Similar to basics of c++ object oriented programming l anguage (20)

IET307 OOP - object oriented programming concepts.pptx
IET307 OOP - object oriented programming concepts.pptxIET307 OOP - object oriented programming concepts.pptx
IET307 OOP - object oriented programming concepts.pptx
BasithAb2
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
Jasleen Kaur (Chandigarh University)
 
CPP-Unit 1.pptx
CPP-Unit 1.pptxCPP-Unit 1.pptx
CPP-Unit 1.pptx
YashKoli22
 
1 intro
1 intro1 intro
1 intro
abha48
 
Procedural-vs-Object-Oriented-Programming (1).pdf
Procedural-vs-Object-Oriented-Programming (1).pdfProcedural-vs-Object-Oriented-Programming (1).pdf
Procedural-vs-Object-Oriented-Programming (1).pdf
AnujMalviya12
 
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbxchapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
berihun18
 
Object model
Object modelObject model
Object model
Hoang Nguyen
 
Object model
Object modelObject model
Object model
Tony Nguyen
 
Object model
Object modelObject model
Object model
Luis Goldster
 
Object model
Object modelObject model
Object model
Harry Potter
 
Object model
Object modelObject model
Object model
Fraboni Ec
 
Object model
Object modelObject model
Object model
James Wong
 
Object model
Object modelObject model
Object model
Young Alista
 
Oop basic overview
Oop basic overviewOop basic overview
Oop basic overview
Deborah Akuoko
 
Introduction to oop with c++
Introduction to oop with c++Introduction to oop with c++
Introduction to oop with c++
Shruti Patel
 
Unit 1 OOSE
Unit 1 OOSE Unit 1 OOSE
Unit 1 OOSE
ChhayaShelake
 
SE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTSE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPT
nikshaikh786
 
Intro to oop.pptx
Intro to oop.pptxIntro to oop.pptx
Intro to oop.pptx
UmerUmer25
 
Introduction.ppt JAVA SCRIPT PROGRAMMING AND
Introduction.ppt JAVA  SCRIPT PROGRAMMING ANDIntroduction.ppt JAVA  SCRIPT PROGRAMMING AND
Introduction.ppt JAVA SCRIPT PROGRAMMING AND
Jifarnecho
 
CPP_,module2_1.pptx
CPP_,module2_1.pptxCPP_,module2_1.pptx
CPP_,module2_1.pptx
AbhilashTom4
 
IET307 OOP - object oriented programming concepts.pptx
IET307 OOP - object oriented programming concepts.pptxIET307 OOP - object oriented programming concepts.pptx
IET307 OOP - object oriented programming concepts.pptx
BasithAb2
 
CPP-Unit 1.pptx
CPP-Unit 1.pptxCPP-Unit 1.pptx
CPP-Unit 1.pptx
YashKoli22
 
1 intro
1 intro1 intro
1 intro
abha48
 
Procedural-vs-Object-Oriented-Programming (1).pdf
Procedural-vs-Object-Oriented-Programming (1).pdfProcedural-vs-Object-Oriented-Programming (1).pdf
Procedural-vs-Object-Oriented-Programming (1).pdf
AnujMalviya12
 
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbxchapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
berihun18
 
Introduction to oop with c++
Introduction to oop with c++Introduction to oop with c++
Introduction to oop with c++
Shruti Patel
 
SE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPTSE-IT JAVA LAB OOP CONCEPT
SE-IT JAVA LAB OOP CONCEPT
nikshaikh786
 
Intro to oop.pptx
Intro to oop.pptxIntro to oop.pptx
Intro to oop.pptx
UmerUmer25
 
Introduction.ppt JAVA SCRIPT PROGRAMMING AND
Introduction.ppt JAVA  SCRIPT PROGRAMMING ANDIntroduction.ppt JAVA  SCRIPT PROGRAMMING AND
Introduction.ppt JAVA SCRIPT PROGRAMMING AND
Jifarnecho
 
CPP_,module2_1.pptx
CPP_,module2_1.pptxCPP_,module2_1.pptx
CPP_,module2_1.pptx
AbhilashTom4
 

Recently uploaded (20)

Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Domino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use CasesDomino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use Cases
panagenda
 
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
Edge AI and Vision Alliance
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
Jasper Oosterveld
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
6th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 20256th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 2025
DanBrown980551
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training RoadblocksDown the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI FoundationsOracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Introduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUEIntroduction to Typescript - GDG On Campus EUE
Introduction to Typescript - GDG On Campus EUE
Google Developer Group On Campus European Universities in Egypt
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Your startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean accountYour startup on AWS - How to architect and maintain a Lean and Mean account
Your startup on AWS - How to architect and maintain a Lean and Mean account
angelo60207
 
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
National Fuels Treatments Initiative: Building a Seamless Map of Hazardous Fu...
Safe Software
 
Domino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use CasesDomino IQ – What to Expect, First Steps and Use Cases
Domino IQ – What to Expect, First Steps and Use Cases
panagenda
 
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
“How Qualcomm Is Powering AI-driven Multimedia at the Edge,” a Presentation f...
Edge AI and Vision Alliance
 
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...Your startup on AWS - How to architect and maintain a Lean and Mean account J...
Your startup on AWS - How to architect and maintain a Lean and Mean account J...
angelo60207
 
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
ELNL2025 - Unlocking the Power of Sensitivity Labels - A Comprehensive Guide....
Jasper Oosterveld
 
Trends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary MeekerTrends Artificial Intelligence - Mary Meeker
Trends Artificial Intelligence - Mary Meeker
Clive Dickens
 
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdfcnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
cnc-drilling-dowel-inserting-machine-drillteq-d-510-english.pdf
AmirStern2
 
6th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 20256th Power Grid Model Meetup - 21 May 2025
6th Power Grid Model Meetup - 21 May 2025
DanBrown980551
 
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy SurveyTrustArc Webinar - 2025 Global Privacy Survey
TrustArc Webinar - 2025 Global Privacy Survey
TrustArc
 
If You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FMEIf You Use Databricks, You Definitely Need FME
If You Use Databricks, You Definitely Need FME
Safe Software
 
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
“State-space Models vs. Transformers for Ultra-low-power Edge AI,” a Presenta...
Edge AI and Vision Alliance
 
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOMEstablish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Establish Visibility and Manage Risk in the Supply Chain with Anchore SBOM
Anchore
 
Down the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training RoadblocksDown the Rabbit Hole – Solving 5 Training Roadblocks
Down the Rabbit Hole – Solving 5 Training Roadblocks
Rustici Software
 
Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.Introduction to Internet of things .ppt.
Introduction to Internet of things .ppt.
hok12341073
 
Oracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI FoundationsOracle Cloud Infrastructure AI Foundations
Oracle Cloud Infrastructure AI Foundations
VICTOR MAESTRE RAMIREZ
 
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und AnwendungsfälleDomino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
Domino IQ – Was Sie erwartet, erste Schritte und Anwendungsfälle
panagenda
 
Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025Mastering AI Workflows with FME - Peak of Data & AI 2025
Mastering AI Workflows with FME - Peak of Data & AI 2025
Safe Software
 
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2Agentic AI: Beyond the Buzz- LangGraph Studio V2
Agentic AI: Beyond the Buzz- LangGraph Studio V2
Shashikant Jagtap
 
Ad

basics of c++ object oriented programming l anguage

  • 2. REFERENCE MATERIAL  Textbook:  C How to program by Paul Detiel and Harvey Detial, Prentice Hall; 10th edition (March 4, 2017)  Reference Books:  The C++ Programming Language, 4th Edition by Bjarne Stroustrup  The C++ Programming Language, 4th Edition 4th Edition by Bjarne Stroustrup, Adison-Wesley Professional  Jumping into C++ by Alex Allian, Cprograming.com
  • 3. WHAT IS OOP?  Object Oriented Programming is a programming technique in which programs are written on basis of objects.  Object is a collection of data and function  Object represent a person, place or thing in real world.  In OOP data and all possible function on data are grouped together.
  • 4. WHAT IS OOP?  Object Oriented Programming is a programming style that is associated with the concept of class, Objects and various other concepts revolving around these two, like inheritance, polymorphism, abstraction, encapsulation.
  • 5. EXAMPLE  A fork is an object with properties  a number of prongs  its size  material (made of plastic or metal), etc.  Behavior and functions of a fork include  Shredding  Squashing  Making design  Eating. 3
  • 7. WHY OOP IS NECESSARY ?  The OOP (Object Oriented Programming) approach is most commonly used approach now a days.  OOP is being used for designing large and complex applications.  The earlier approaches to programming were not that good, and there were several limitations as well.
  • 8. EVOLUTION OF OO PROGRAMING  These programming approaches have been passing through revolutionary phases just like computer hardware. Machine Language Monolithic Approach Procedural Approach Structural Approach OOP
  • 9. EVOLUTION OF OO PROGRAMING  Machine Language  for designing small and simple programs  Monolithic Programming Approach  the program consists of sequence of statements that modify data.  code is duplicated each time because there is no support for the function.  data is not fully protected as it can be accessed from any portion of the program.  programming languages include ASSEMBLY and BASIC.
  • 10. EVOLUTION OF OO PROGRAMING  Procedural Programming Approach  Program is divided into functions that perform a specific task.  Data is global and all the functions can access the global data.  This approach avoids repetition of code which is the main drawback of Monolithic Approach.  Enabled us to write larger and hundred lines of code
  • 11. EVOLUTION OF OO PROGRAMING  Structured Programming Approach  divide a program in functions and modules.  The use of modules and functions makes the program more understandable.  It helps to write cleaner code and helps to maintain control over each function.  Developed for designing medium sized programs.  The programming languages: PASCAL and C follow this approach.
  • 12. EVOLUTION OF OO PROGRAMING  Object Oriented Programming Approach  The basic principal of the OOP approach is to combine both data and functions so that both can operate into a single unit. Such a unit is called an Object.  This approach secures data also.  Now a days this approach is used mostly in applications.  The programming languages: C++ and JAVA follow this approach.
  • 13. OBJECT ORIENTED DESIGN  Object-oriented design (OOD) is the process of creating a software system or application utilizing an object-oriented model.  This technique permits the creation of a software solution based on object notion.  OOD is an implementation of the object-oriented programming (OOP) paradigm.
  • 14. OBJECT ORIENTED DESIGN  In the object-oriented design method, the system is considered a collection of objects (i.e., entities).  The state is shared among the objects, and each object is responsible for its own state data.  Similar objects form a class.  In other words, every object belongs to a class.
  • 16. OBJECT ORIENTED DESIGN  Objects  An Object can be defined as an entity that has a state and behavior, or in other words, anything that exists physically in the world is called an object. It can represent a dog, a person, a table, etc.  An object means the combination of data and programs, which further represent an entity.
  • 17. OBJECT ORIENTED DESIGN  Classes  Class can be defined as a blueprint of the individual object, attribute and method.  Method  Function that describe behavior of class  Attribute  Define in class and represents state of object.
  • 18. OBJECT ORIENTED DESIGN  Example of class and object
  • 19. OBJECT ORIENTED DESIGN  Example of class, method and attributes
  • 20. OBJECT ORIENTED DESIGN  Message  Objects communicate by passing messages.  Messages contain the name of the requested operation, and any other action required to complete the function.  Messages are frequently implemented through function calls.
  • 21. PRINCIPALS OF OOP  Encapsulation  Abstraction  Inheritance  Polymorphism
  • 22. PRINCIPALS OF OOP  Encapsulation  The wrapping up of data and functions together in a single unit is known as encapsulation.  All properties and methods of an object are kept private and save from other object.  Encapsulation makes the data non-accessible to the outside world.
  • 23. PRINCIPALS OF OOP  Encapsulation
  • 24. PRINCIPALS OF OOP  Abstraction  Abstraction helps in the data hiding process.  It helps in displaying the essential features without showing the details or the functionality to the user.  It avoids unnecessary information or irrelevant details and shows only that specific part which the user wants to see.
  • 25. PRINCIPALS OF OOP  Abstraction
  • 26. PRINCIPALS OF OOP  Inheritance  Inheritance is the process in which two classes have an is-a relationship among each other and objects of one class acquire properties and features of the other class.  The class which inherits the features is known as the child class, and the class whose features it inherited is called the parent class.  For example, Class Vehicle is the parent class, and Class Bus, Car, and Bike are child classes.
  • 27. PRINCIPALS OF OOP  Inheritance
  • 28. PRINCIPALS OF OOP  Polymorphism  Polymorphism means many forms.  It is a feature that provides a function or an operator with more than one definition.  It can be implemented using function overloading, operator overload, function overriding, virtual function.
  • 29. PRINCIPALS OF OOP  Polymorphism
  • 30. OBJECT-ORIENTED PROBLEM SOLVING APPROACH  Object-oriented problem solving approach is very similar to the way a human solves daily problems. It consists of identifying objects and how to use these objects in the correct sequence to solve the problem.
  • 31. OBJECT-ORIENTED PROBLEM SOLVING APPROACH  In other words, object-oriented problem solving can consist of designing objects whose behavior solves a specific problem. A message to an object causes it to perform its operations and solve its part of the problem.
  • 32. OBJECT-ORIENTED PROBLEM SOLVING APPROACH  The object-oriented problem solving approach, in general, can be divided into following steps. They are: 1. Understanding the problem 2. Formulating a model 3. Developing an algorithm 4. Writing a subsequent program 5. Testing and improving the program 6. Evaluating the solution.
  • 33. OBJECT-ORIENTED PROBLEM SOLVING APPROACH  Understanding the problem The question has asked to find the mean of all the given grades of a student
  • 34. OBJECT-ORIENTED PROBLEM SOLVING APPROACH  Formulating a model Average = grade1 + grade2 + …. + gradeN number of records
  • 35. OBJECT-ORIENTED PROBLEM SOLVING APPROACH  Developing an algorithm grades_array = grades, sum=0 for grade in grade array add grades -> sum average <- sum / length(grades_array)
  • 36. OBJECT-ORIENTED PROBLEM SOLVING APPROACH  Writing a subsequent program A program is written following the above algorithm in the programming language of choice.
  • 37. OBJECT-ORIENTED PROBLEM SOLVING APPROACH  Testing and improving the program The program is tested against all kinds of data including but not limited to corner cases that may break the algorithm such as the length of the array being returned as 0.
  • 38. OBJECT-ORIENTED PROBLEM SOLVING APPROACH  Evaluating the solution The solution is evaluated and checked whether the output is correct or not.
  • 39. PROS OF OOP  Secure  Reusability  High productivity  Reduce redundancy  Low-cost development  Easy to maintain and modify  Allows for parallel development.
  • 40. DRAWBACKS OF OOP  Complexity  Hardware Constraints  Size is larger than other programs  It required a lot of effort to create  It is slower than other programs  It is not suitable for some sorts of problems  It takes time to get used to it.