You are on page 1of 20

What is OOP?

 OOP is a programming paradigm


employing objects and classes in the
design of software applications
CONCEPTS OF OOP
 OBJECTS AND CLASSES
 DATA ABSTRACTION
 DATA ENCAPSULATION
 POLYMORPHISM
 INHERITANCE
 ADVANTAGES OF OOP
OBJECTS AND CLASSES
 Object represents an identifiable entity with
some characteristics and behaviour.
 Class represents a group of similar objects.
EXAMPLE
class account{
int account_no;
char type;
float balance;
};
Here account is class where as account_no,
type and balance are attributes.
DATA ABSTRACTION
 The act of representing the essential
features without including the background
details and explanations.
 Also known as data hiding.
EXAMPLE IN REAL WORLD
 You are driving a car. You know the
essential features like gears, brakes,
steering etc. but you don’t know about
motor or engine working.
 You only start the switches but you don’t
know how it is working internally.
 This is known as abstraction.
DATA ENCAPSULATION
 It is the wrapping up of data and associated
functions in one single unit.
NOTES
 Abstraction and Encapsulation are
complimentary concepts.
 Abstraction focuses upon the behaviour of
an object.
 Where as Encapsulation focuses upon its
implementation.
POLYMORPHISM
 It 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 classes.
EXAMPLE IN REAL WORLD
 A single name function can be used to handle different number and
different type of arguments..
INHERITANCE
 It is the capability of one class to inherit
properties from other class.
 The class which is defined first, whose
properties and behaviour are used by other
classes is known as Base Class.
 The class which inherits the properties of
Base Class is known as Derived Class.
IMPLEMENTATION
 Inheritance is implemented in C++ by
specifying name of base class from which
the derived class.
 class<derived class name>:<base class name>
{

};
EXAMPLE: IN REAL WORLD
 We can build a set of classes that describe
a library of publications. Let there be two
types of publication: Periodical and Books.
 So we will create a class named Publication
by defining data items.
 Next we will define two derived classes
named Periodical and Book.
EXAMPLE: IN REAL WORLD
 Here Book and Periodical class share the
characteristics of Publication class while having
their own attributes.
ADVANTAGES OF OOP…
 EASE OF FABRICATION AND MAINTENANCE:
MAINTENANCE
The concepts such as Encapsulation, Abstraction
allow for very clean designs. When an object is
going into disallowed states, which are not
permitted, only its methods need to be
investigated. e.g. if student is getting more than
maximum marks, only the functions are to be
retested. This narrows down search for problem.
ADVANTAGES OF OOP…
 EASY REDESIGN AND EXTENSION:
EXTENSION The
concepts explained above also facilitate
redesign and extension.
 EASE OF COMPREHENSION:
COMPREHENSION The
classes can be set up to closely represent
the generic application concepts and
process. OOP codes are more near to real
world models than other ‘programming
methodology codes’.
ADVANTAGES OF OOP…
 RE-USE OF CODES:
CODES Linking of code to
objects and explicit specification of relations
between objects allows class definitions to
be re-used in other applications. The
availability of a consistent interface to
object lessens code duplication.

You might also like