OBJECT ORIENTED
PROGRAMMING
OVERVIEW
Introduction to OOPs
Definition of OOPs
Building blocks of OOPs
Pillars of OOPs
Popular languages which use OOPs
Benefits of OOPs
2
INTRODUCTION TO OOPs
Object Oriented Programming(OOPs) is the fundamental
programming paradigm taught to developers at some point in
their career.
It is used as the standard way of coding among developers.
3
DEFINITION OF OOPs
Object-Oriented Programming (or OOP) is a
paradigm of programming in which
programs are written and structured around
objects rather than functions or logic.
Here, objects are defined as data fields that
have unique attributes and behavior. They
contain data in the form of attributes and
procedures in the form of methods. Object
procedures can access and modify the data
present in an object.
4
BUILDING BLOCKS OF OOPs
The fundamental building blocks of an
OOP program are :
 Classes
 Objects
 Methods
 Attributes
5
•Blueprint
Classe
s
•Instances
Object
s
•Data
Attributes
•Behaviour
Methods
CLASSES
Classes are essentially user defined
data types. Classes are where we
create a blueprint for the structure
of methods and attributes.
Individual objects are instantiated,
or created from this blueprint.
The given code snippet
demonstrates a class Dog() in
Python.
6
OBJECTS
An Object is an instance of a Class. A class is like a
blueprint while an instance is a copy of the class with
actual values.
In the given example, an object is instantiated which is
basically a dog named Rodger. This class only has two
class attributes that tell us that Rodger is a dog and a
mammal. 7
Objects
State
It is represented by
the attributes of an
object. It also reflects
the properties of an
object.
Behaviour
It is represented by
the methods of an
object. It also reflects
the response of an
object to other objects.
Identity
It gives a unique name
to an object and
enables one object to
interact with other
objects.
ATTRIBUTES
Attributes are the information that is
stored inside an object.
Attributes are defined in the Class
template. When objects are
instantiated individual objects contain
data stored in the Attributes field.
In the given code example ‘atrr1’ and
‘attr2’ are the attributes of the class
Dog.
8
METHODS
Methods represent behaviors.
Methods perform actions; methods might
return information about an object, or update
an object’s data. The method’s code is
defined in the class definition.
Methods often modify, update or delete data.
Methods are how programmers promote
reusability, and keep functionality
encapsulated inside an object. This
reusability is a great benefit when
debugging.
In the given code example ‘fun()’ is a method
of the class Dog.
9
PILLARS OF OOPs
There are four principles of
Object Oriented Programming –
1. Encapsulation
2. Abstraction
3. Inheritance
4. Polymorphism
10
4 Pillars
of OOPs
ENCAPSULA
TION
ABSTRACTION
INHERITANCE
POLYMORPHISM
ENCAPSULATION
Encapsulation is defined as binding together the data and the functions that
manipulate them under a single unit.
11
ABSTRACTION
Data abstraction refers to providing only essential
information about the data to the outside world,
hiding the background details or its
implementation.
We can take the example of a car from the real
world. In a car’s design we can have many features
like Key(Switch), a steering wheel for turning the
car, brake and accelerator paddles to speed up and
slow down the car
But this doesn't mean that the driver needs to
know about how each of these components works,
he only needs to know about how the car looks
like, what type of features it includes, and which
plan is used to build it.
12
INHERITANCE
The capability of a class to
derive properties and
characteristics from another
class is called Inheritance.
Inheritance is one of the most
important features of Object-
Oriented Programming.
The class that derives properties
is called the derived class or
child class and the class from
which the properties are being
derived is called the base class
or parent class.
13
TYPES OF INHERITANCE
POLYMORPHISM
Polymorphism means designing objects to share behaviors. Using inheritance,
objects can override shared parent behaviors, with specific child behaviors.
Polymorphism allows the same method to execute different behaviors in two ways:
method overriding and method overloading.
14
Polymorphism in len() function - Python
Polymorphism
Compile Time Polymorphism
Function
Overloading
Operator
Overloading
Run Time
Polymorphism
Virtual
Function
BENEFITS OF USING OOPs
It renders complex
models as simple
reproducible
structures
OOP objects can be
reused across
programs
It allows for class-
specific behavior
through
polymorphism
It is easier to debug.
Classes often contain
all applicable
information to them
•It provides security.
The information is
protected through
encapsulation
15
POPULAR LANGUAGES WHICH USE
OOPS
16
17
THANK YOU
https://www.cetpainfotech.com/
9212172602
QUERY@CETPAINFOTECH.COM

OOPS

  • 1.
  • 2.
    OVERVIEW Introduction to OOPs Definitionof OOPs Building blocks of OOPs Pillars of OOPs Popular languages which use OOPs Benefits of OOPs 2
  • 3.
    INTRODUCTION TO OOPs ObjectOriented Programming(OOPs) is the fundamental programming paradigm taught to developers at some point in their career. It is used as the standard way of coding among developers. 3
  • 4.
    DEFINITION OF OOPs Object-OrientedProgramming (or OOP) is a paradigm of programming in which programs are written and structured around objects rather than functions or logic. Here, objects are defined as data fields that have unique attributes and behavior. They contain data in the form of attributes and procedures in the form of methods. Object procedures can access and modify the data present in an object. 4
  • 5.
    BUILDING BLOCKS OFOOPs The fundamental building blocks of an OOP program are :  Classes  Objects  Methods  Attributes 5 •Blueprint Classe s •Instances Object s •Data Attributes •Behaviour Methods
  • 6.
    CLASSES Classes are essentiallyuser defined data types. Classes are where we create a blueprint for the structure of methods and attributes. Individual objects are instantiated, or created from this blueprint. The given code snippet demonstrates a class Dog() in Python. 6
  • 7.
    OBJECTS An Object isan instance of a Class. A class is like a blueprint while an instance is a copy of the class with actual values. In the given example, an object is instantiated which is basically a dog named Rodger. This class only has two class attributes that tell us that Rodger is a dog and a mammal. 7 Objects State It is represented by the attributes of an object. It also reflects the properties of an object. Behaviour It is represented by the methods of an object. It also reflects the response of an object to other objects. Identity It gives a unique name to an object and enables one object to interact with other objects.
  • 8.
    ATTRIBUTES Attributes are theinformation that is stored inside an object. Attributes are defined in the Class template. When objects are instantiated individual objects contain data stored in the Attributes field. In the given code example ‘atrr1’ and ‘attr2’ are the attributes of the class Dog. 8
  • 9.
    METHODS Methods represent behaviors. Methodsperform actions; methods might return information about an object, or update an object’s data. The method’s code is defined in the class definition. Methods often modify, update or delete data. Methods are how programmers promote reusability, and keep functionality encapsulated inside an object. This reusability is a great benefit when debugging. In the given code example ‘fun()’ is a method of the class Dog. 9
  • 10.
    PILLARS OF OOPs Thereare four principles of Object Oriented Programming – 1. Encapsulation 2. Abstraction 3. Inheritance 4. Polymorphism 10 4 Pillars of OOPs ENCAPSULA TION ABSTRACTION INHERITANCE POLYMORPHISM
  • 11.
    ENCAPSULATION Encapsulation is definedas binding together the data and the functions that manipulate them under a single unit. 11
  • 12.
    ABSTRACTION Data abstraction refersto providing only essential information about the data to the outside world, hiding the background details or its implementation. We can take the example of a car from the real world. In a car’s design we can have many features like Key(Switch), a steering wheel for turning the car, brake and accelerator paddles to speed up and slow down the car But this doesn't mean that the driver needs to know about how each of these components works, he only needs to know about how the car looks like, what type of features it includes, and which plan is used to build it. 12
  • 13.
    INHERITANCE The capability ofa class to derive properties and characteristics from another class is called Inheritance. Inheritance is one of the most important features of Object- Oriented Programming. The class that derives properties is called the derived class or child class and the class from which the properties are being derived is called the base class or parent class. 13 TYPES OF INHERITANCE
  • 14.
    POLYMORPHISM Polymorphism means designingobjects to share behaviors. Using inheritance, objects can override shared parent behaviors, with specific child behaviors. Polymorphism allows the same method to execute different behaviors in two ways: method overriding and method overloading. 14 Polymorphism in len() function - Python Polymorphism Compile Time Polymorphism Function Overloading Operator Overloading Run Time Polymorphism Virtual Function
  • 15.
    BENEFITS OF USINGOOPs It renders complex models as simple reproducible structures OOP objects can be reused across programs It allows for class- specific behavior through polymorphism It is easier to debug. Classes often contain all applicable information to them •It provides security. The information is protected through encapsulation 15
  • 16.
  • 17.