The problem is decomposed in smaller units
named procedures and data can be
assembled in packages, called structures.
Data and procedures are separated.
C, Pascal, Fortran are procedural languages
Limitations of Procedural Programming
 Procedural programming is susceptible to design
 As design changes lead to many modification in the
code this lead to increased time and cost overheads
at times
 Programs created in procedural languages are difficult to
manage, hard to maintain and expensive to extend.
 A new way to program : Object Oriented Programming (OOP)
 Object oriented programming is a tool for new challenges in
software development
 offers a closer fit to the way human think
 improves communication
 improves the quality of software
 Goal : to design high quality software at low cost
 Important OOP concepts:
 Classes
 Objects
 Encapsulation
 Data hiding
 Inheritance
 Polymorphism
Don’t think about data and functions
separately, think about objects. Objects are
small bundles of data which know how to do
thing with themselves.
 You can think: A car is a collection of wheels, doors,
seats, windows. But think what a car can do:
move, speed up, slow down, stop, park, etc. Put
everything you know about a car in one object.
 An Object is an identifiable entity with some
characteristics and behavior.
 All cars are objects of the same type. The description
of this type is a class: class Car
 It is a template representing a group of objects that
share a common properties and relationships.
 Software code in OOPs is written to define classes,
objects and manipulate these object
 Real World objects have physical characteristics
(state) and behavior e.g., motorbike
 Characteristics – current gear, two wheel etc
 Behavior – braking, accelerating etc
 Their characteristics is maintained through variables
or data items.
 Their behavior is implemented through function
generally called methods
 Data Abstraction
 It refers to the act of representing essential features without
including the background details or explanations.
 Encapsulation
 The wrapping up of data and functions into a single unit (class) is
called as encapsulation. A class binds together data and its
associated functions under one unit thereby enforcing
encapsulation. It is a way of implementing abstraction.
 Benefits with encapsulation: (i) Modularity. (ii) Information
 Data Hiding:
 A class groups its members into three sections: private, protected
and public. The private and protected members remain hidden
from outside world. Thus through private and protected
members, a class enforces data – hiding. (The outside world is
given only the essential and necessary information through
public members, rest of the things remain hidden, which is
nothing but abstraction.)
class ABC
{ private:
int a,b;
int c,d;
int e,f;
void disp( )
{ }
 In the above class public members(ie e,f and disp( ))
only will be available to outside the class..
 The other private members (a,b), protected members
(c,d) will not be available to outside the class. This
concept is called data hiding.
The capability of one class to inherit
properties from another class is called as
inheritance. The class inheritance, lets
you generate a model that is closer to the
real world. The class whose properties
are inherited is called base class (Super
class) and the class that inherits the
properties is known as derived class
(Base class).
The most important advantage of
inheritance is code reusability.
For example, a student as well as a staff is a
Person. Both have some common properties.
Inheritance allows the programmer to reuse
defined properties. A subclass defines only those
features that are unique to it .
Polymorphism is a Greek word which can be
divided into 2 sub word i.e., poly stands for
many and morphism stands for forms.
Polymorphism means ability to take more than
one form.
Polymorphism in the context of object-
oriented programming, is the ability to create
a variable, a function, or an object that has
more than one form.
Polymorphism allows the usage of same
operators or functions in different ways. eg:
7+3 is used for addition "poly"+"morphism" is
used for concatenating these two words