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)

PPTX
IET307 OOP - object oriented programming concepts.pptx
BasithAb2
 
PPTX
CPP-Unit 1.pptx
YashKoli22
 
PPTX
1 intro
abha48
 
DOC
Introduction to OOPs Concept- Features, Basic concepts, Benefits and Applicat...
KrishnaveniT8
 
PDF
Procedural-vs-Object-Oriented-Programming (1).pdf
AnujMalviya12
 
PPTX
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
berihun18
 
PPTX
Object model
Hoang Nguyen
 
PPTX
Object model
Tony Nguyen
 
PPTX
Object model
Luis Goldster
 
PPTX
Object model
Harry Potter
 
PPTX
Object model
Fraboni Ec
 
PPTX
Object model
James Wong
 
PPTX
Object model
Young Alista
 
PDF
Oop basic overview
Deborah Akuoko
 
PPTX
2-oops-concepts_about_c++_btech_cse.pptx
NitinGarg168992
 
PPTX
Introduction to oop with c++
Shruti Patel
 
PPTX
Unit 1 OOSE
ChhayaShelake
 
PPTX
SE-IT JAVA LAB OOP CONCEPT
nikshaikh786
 
PPTX
An introduction to object-oriented programming.pptx
olisahchristopher
 
IET307 OOP - object oriented programming concepts.pptx
BasithAb2
 
CPP-Unit 1.pptx
YashKoli22
 
1 intro
abha48
 
Introduction to OOPs Concept- Features, Basic concepts, Benefits and Applicat...
KrishnaveniT8
 
Procedural-vs-Object-Oriented-Programming (1).pdf
AnujMalviya12
 
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
berihun18
 
Object model
Hoang Nguyen
 
Object model
Tony Nguyen
 
Object model
Luis Goldster
 
Object model
Harry Potter
 
Object model
Fraboni Ec
 
Object model
James Wong
 
Object model
Young Alista
 
Oop basic overview
Deborah Akuoko
 
2-oops-concepts_about_c++_btech_cse.pptx
NitinGarg168992
 
Introduction to oop with c++
Shruti Patel
 
Unit 1 OOSE
ChhayaShelake
 
SE-IT JAVA LAB OOP CONCEPT
nikshaikh786
 
An introduction to object-oriented programming.pptx
olisahchristopher
 

Recently uploaded (20)

PPT
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
PDF
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
PDF
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
Digital Circuits, important subject in CS
contactparinay1
 
PDF
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
DOCX
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PPTX
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
PPTX
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Ericsson LTE presentation SEMINAR 2010.ppt
npat3
 
NLJUG Speaker academy 2025 - first session
Bert Jan Schrijver
 
The 2025 InfraRed Report - Redpoint Ventures
Razin Mustafiz
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
“Computer Vision at Sea: Automated Fish Tracking for Sustainable Fishing,” a ...
Edge AI and Vision Alliance
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Digital Circuits, important subject in CS
contactparinay1
 
Book industry state of the nation 2025 - Tech Forum 2025
BookNet Canada
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
How do you fast track Agentic automation use cases discovery?
DianaGray10
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Cryptography Quiz: test your knowledge of this important security concept.
Rajni Bhardwaj Grover
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
Future Tech Innovations 2025 – A TechLists Insight
TechLists
 
The Project Compass - GDG on Campus MSIT
dscmsitkol
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
“NPU IP Hardware Shaped Through Software and Use-case Analysis,” a Presentati...
Edge AI and Vision Alliance
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
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.