OBJECT ORIENTED PROGRAMMING
LANGUAGES
OBJECT ORIENTED PROGRAMMING LANGUAGES
In Object Programming Concepts, computer programs are designed
by using objects that interact with one another. For example:-
➢ An online shopping system might have objects such as shopping
cart, customer, product, etc.
➢ A banking system consists of objects such as customer, account,
employee, etc.
OBJECT
Each object has its own properties:-
➢ Characteristics/attributes/data → describes the state of an
object
➢ Behaviour → describes the different operations
CLASS
Class is a blueprint or template that helps to create
multiple instances that has its own unique identity and
each instance is called an object.
Class is also referred as an object factory as it is used to
create multiple objects that have their own attributes and
behaviour.
CLASS DESIGN – in software terms
➢ Characteristics/attributes/data → Data members/variables
➢ Behaviour → functions/methods
EXAMPLE CLASS
ClassName
BankAccount Rahul Asha Jayasree
23456 54321 67894
25000 1800 15000
List
name
3/6/2020 3/6/2013 23/5/2014
Of
accountNumber
Savings Savings Current
Attributes
balance variables Delhi Bengaluru Chennai
.dateOpened
.accountType
open() open() open()
branch
close() close() close()
deposit() deposit() deposit()
List withdraw() withdraw() withdraw()
open( )
Of
close( )
Operations
deposit( )
Functions/ RahulAcct AshaAcct JayaAcct
. Methods
withdraw( )
.
Objects (instances)
class
PRINCIPLES OF OBJECT ORIENTED
PROGRAMMING LANGUAGES
a) Abstraction
b) Encapsulation
c) Polymorphism
d) Inheritance
ABSTRACTION
Abstraction is the act of representing only the
necessary functionalities to the user and hiding
the internal implementation details from the user.
➢It reduces the complexity of the problem.
ABSTRACTION: REAL WORLD EXAMPLE
ABSTRACTION: REAL WORLD EXAMPLE
ENCAPSULATION
It is the mechanism that binds the data and the code that
manipulates it into a single unit. This keeps data and
functions safe from external interference and misuse. It
ensures data security.
ENCAPSULATION : REAL WORLD EXAMPLE
It contains both data( ie
ingredients to prepare coffee) and
operations (i.e. service
mechanism )and they are
wrapped/integrated under a
single unit coffee Vending
Machine. This is
called Encapsulation.
ENCAPSULATION : REAL WORLD EXAMPLE
It contains both data( ie currency)
and operations (money
withdrawal, mini-statement,
enquire balance,etc )and they are
wrapped/integrated under a
single unit -ATM. This is
called Encapsulation.
POLYMORPHISM
Polymorphism is derived from 2 Greek words poly meaning
“many” and morph meaning “forms”. It is the capability of an
interface to do different things based on the data it accepts and
gives the desired output.
INHERITANCE
Inheritance is the mechanism where the properties(data
& its method) of one class is acquired by the other
class. It helps in code reusability.
INHERITANCE
The class which inherits the properties of an another
class is called derived class(or subclass). The class
whose properties are inherited is called as base
class(super class).
Object Oriented Programming
(Data Centric Approach)
Advantages:-
• Any real world entity can be modeled using Object Oriented
Programming language.
• In Object Oriented Programming, the objects are built up in such a
that it can be used in other programs as well. So, it ensures
reusability.
• It is simpler to change when the requirements for the application
change.
• It ensures data security.