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

PDF
Computer_Programming_Part_II_Segment_01.pdf
PPT
Basic concept of OOP's
PPTX
Object Oriented Programming using C++.pptx
PPTX
OOP-1.pptx
PPTX
POP vs OOP Introduction
PPTX
Lecture 1 oop
PDF
OOP ppt.pdf
PPTX
OOP.pptx
Computer_Programming_Part_II_Segment_01.pdf
Basic concept of OOP's
Object Oriented Programming using C++.pptx
OOP-1.pptx
POP vs OOP Introduction
Lecture 1 oop
OOP ppt.pdf
OOP.pptx

Similar to introduction to object oriented programming (20)

PPTX
IET307 OOP - object oriented programming concepts.pptx
PPTX
Unit - I Intro. to OOP Concepts and Control Structure -OOP and CG (2024 Patte...
PPTX
CPP-Unit 1.pptx
PPTX
1 intro
DOC
Introduction to OOPs Concept- Features, Basic concepts, Benefits and Applicat...
PDF
Procedural-vs-Object-Oriented-Programming (1).pdf
PPTX
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
PPTX
Object model
PPTX
Object model
PPTX
Object model
PPTX
Object model
PPTX
Object model
PPTX
Object model
PPTX
Object model
PDF
Oop basic overview
PPTX
2-oops-concepts_about_c++_btech_cse.pptx
PPTX
Introduction to oop with c++
PPTX
Unit 1 OOSE
PPTX
SE-IT JAVA LAB OOP CONCEPT
IET307 OOP - object oriented programming concepts.pptx
Unit - I Intro. to OOP Concepts and Control Structure -OOP and CG (2024 Patte...
CPP-Unit 1.pptx
1 intro
Introduction to OOPs Concept- Features, Basic concepts, Benefits and Applicat...
Procedural-vs-Object-Oriented-Programming (1).pdf
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
Object model
Object model
Object model
Object model
Object model
Object model
Object model
Oop basic overview
2-oops-concepts_about_c++_btech_cse.pptx
Introduction to oop with c++
Unit 1 OOSE
SE-IT JAVA LAB OOP CONCEPT
Ad

Recently uploaded (20)

PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Open folder Downloads.pdf yes yes ges yes
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
O7-L3 Supply Chain Operations - ICLT Program
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
The Final Stretch: How to Release a Game and Not Die in the Process.
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
PDF
Module 3: Health Systems Tutorial Slides S2 2025
PPTX
Revamp in MTO Odoo 18 Inventory - Odoo Slides
PDF
From loneliness to social connection charting
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
Business Ethics Teaching Materials for college
DOCX
UPPER GASTRO INTESTINAL DISORDER.docx
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
O5-L3 Freight Transport Ops (International) V1.pdf
Open folder Downloads.pdf yes yes ges yes
Pharmacology of Heart Failure /Pharmacotherapy of CHF
O7-L3 Supply Chain Operations - ICLT Program
NOI Hackathon - Summer Edition - GreenThumber.pptx
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
The Final Stretch: How to Release a Game and Not Die in the Process.
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
Module 3: Health Systems Tutorial Slides S2 2025
Revamp in MTO Odoo 18 Inventory - Odoo Slides
From loneliness to social connection charting
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Business Ethics Teaching Materials for college
UPPER GASTRO INTESTINAL DISORDER.docx
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PSYCHOLOGY IN EDUCATION.pdf ( nice pdf ...)
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Ad

introduction to object oriented programming

  • 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.