• OOPs is opposite to POP
(Procedure Oriented
Programming)
• C++ is an object
oriented programming
language .
 Object Oriented Programming System is
a object based programming. It is used to
create and execute the program in C++.
1) Objects
2) Classes
3) Data Abstraction
4) Encapsulation
5) Inheritance
6) Polymorphism
7) Dynamic Binding
8) Message Passing
1) OBJECT –
Object are the basic run time entities in an object
oriented system they may be represent a person, a
place, a account, etc. items that the programs has to
handle they may also represent user defined data.
FOR EX. - EVERYTHING IS AN OBJECT :-
 A student, a professor
 A desk, a chair, a classroom, a building
 A university, a city, a country
 The world, the universe
 A subject such as CS, IS, Math, History, …
2) CLASS -
A class is a set (collection) of similar types of
objects
 Classes are user defined data types and we
have built in types of a programming language.
EXAMPLE –
• The “account” class defines two state
variables (account number and
balance) and two methods (deposit
and withdraw).
• Other example - Apple, Banana,
Orange, Grapes etc are members of
the class fruits.
class: Account
number:
balance:
deposit()
withdraw()
3) DATA ABSTRACTION –
Data abstraction refers of the act of representing
essential features without including the background
details and explanation.
• Abstraction focuses upon the observable behavior of
an object.
• Data abstraction is a mechanism of exposing only
the interfaces and hiding the implementation details
from the user.
4) ENCAPSULATION –
• Encapsulation is a way to implement data
abstraction.
• Encapsulation hides the details of the
implementation of an object.
• Encapsulation is a mechanism of bundling the data
and the functions that use them.
The wrapping up of data and
operations/function into a single unit (called
class) is known as encapsulation.
5) INHERITANCE –
Inheritance is somewhat analogous to using
functions to simplify a traditional procedural
program.
Inheritance is the process by which object of
one class acquired the properties of object of
another class.
 Expresses commonality among objects
 Allows code reusability
6) POLYMORPHISM -
Polymorphism is the ability for a message or data to
be processed in more than one form.
Polymorphism is a property by which the same
message can be sent to objects of several different
class.
• Polymorphism is the concept that supports the
capability of an object of a class of behave
differently in response to a message or action.
• Polymorphism is extensively used in
implementing inheritance.
7) DYNAMIC BINDING -
In C++ we can have an array of base classes but we
can call different functions of the derived class by
using virtual functions- this is dynamic binding.
 If the methods are virtual then this is dynamic
binding.
•In OOPs Dynamic Binding refers to linking a
procedure call to the code that will be executed
only at run time.
8) MESSAGE PASSING -
The process of message passing follow basic steps-
• Creating classes that define objects and their
behavior.
• Creating objects from class definition.
• Establishing communication among objects.
An oops consist of set of objects that
communicate with each other.
Object Oriented Programming

Object Oriented Programming

  • 2.
    • OOPs isopposite to POP (Procedure Oriented Programming) • C++ is an object oriented programming language .  Object Oriented Programming System is a object based programming. It is used to create and execute the program in C++.
  • 3.
    1) Objects 2) Classes 3)Data Abstraction 4) Encapsulation 5) Inheritance 6) Polymorphism 7) Dynamic Binding 8) Message Passing
  • 4.
    1) OBJECT – Objectare the basic run time entities in an object oriented system they may be represent a person, a place, a account, etc. items that the programs has to handle they may also represent user defined data. FOR EX. - EVERYTHING IS AN OBJECT :-  A student, a professor  A desk, a chair, a classroom, a building  A university, a city, a country  The world, the universe  A subject such as CS, IS, Math, History, …
  • 5.
    2) CLASS - Aclass is a set (collection) of similar types of objects  Classes are user defined data types and we have built in types of a programming language. EXAMPLE – • The “account” class defines two state variables (account number and balance) and two methods (deposit and withdraw). • Other example - Apple, Banana, Orange, Grapes etc are members of the class fruits. class: Account number: balance: deposit() withdraw()
  • 6.
    3) DATA ABSTRACTION– Data abstraction refers of the act of representing essential features without including the background details and explanation. • Abstraction focuses upon the observable behavior of an object. • Data abstraction is a mechanism of exposing only the interfaces and hiding the implementation details from the user.
  • 7.
    4) ENCAPSULATION – •Encapsulation is a way to implement data abstraction. • Encapsulation hides the details of the implementation of an object. • Encapsulation is a mechanism of bundling the data and the functions that use them. The wrapping up of data and operations/function into a single unit (called class) is known as encapsulation.
  • 8.
    5) INHERITANCE – Inheritanceis somewhat analogous to using functions to simplify a traditional procedural program. Inheritance is the process by which object of one class acquired the properties of object of another class.  Expresses commonality among objects  Allows code reusability
  • 9.
    6) POLYMORPHISM - Polymorphismis the ability for a message or data to be processed in more than one form. Polymorphism is a property by which the same message can be sent to objects of several different class. • Polymorphism is the concept that supports the capability of an object of a class of behave differently in response to a message or action. • Polymorphism is extensively used in implementing inheritance.
  • 10.
    7) DYNAMIC BINDING- In C++ we can have an array of base classes but we can call different functions of the derived class by using virtual functions- this is dynamic binding.  If the methods are virtual then this is dynamic binding. •In OOPs Dynamic Binding refers to linking a procedure call to the code that will be executed only at run time.
  • 11.
    8) MESSAGE PASSING- The process of message passing follow basic steps- • Creating classes that define objects and their behavior. • Creating objects from class definition. • Establishing communication among objects. An oops consist of set of objects that communicate with each other.