0% found this document useful (0 votes)
11 views

OOP Unit-1

The document provides an overview of Object Oriented Programming (OOP), detailing its characteristics, concepts, and benefits. Key concepts include classes, objects, encapsulation, inheritance, and polymorphism, alongside comparisons with procedural programming. OOP is highlighted for its advantages in code organization, reusability, and security.

Uploaded by

yogeshptl7694
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

OOP Unit-1

The document provides an overview of Object Oriented Programming (OOP), detailing its characteristics, concepts, and benefits. Key concepts include classes, objects, encapsulation, inheritance, and polymorphism, alongside comparisons with procedural programming. OOP is highlighted for its advantages in code organization, reusability, and security.

Uploaded by

yogeshptl7694
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Object Oriented Programming

UNIT – I

Arpit Deo
Assistant Professor,
Computer Science & Engineering Department,
Medi-Caps University, Indore
Unit-1
Introduction to OOP
Characteristics
Applications
Difference between object oriented and procedure based programming
OOP languages
OOP concepts: Abstraction, Encapsulation, Polymorphism,
Inheritance and Information Hiding.

Arpit Deo (Assistant Professor, Medi-Caps University, Indore)


Introduction
• Object Oriented programming (OOP) is a programming paradigm that
includes or relies on the concept of classes and objects.
• It is used to structure a software program into simple, reusable pieces
of code blueprints (usually called classes) which are used to create
individual instances of objects.
• Because OOP is a programming paradigm, there are many object-
oriented programming languages including: C++, Java, Ruby and
Python.

Arpit Deo (Assistant Professor, Medi-Caps University, Indore)


Why OOP?
• OOP makes code organized, reusable, and easy to maintain; It follows
the DRY method (Don’t Repeat Yourself).
• Benefits of OOP include security; OOP prevents unwanted access to
data, or exposing proprietary code through encapsulation and
abstraction - both are discussed further in the Principles of OOP section.
• So how do programmers create Object Oriented programs? Well the
short answer is by making classes, and creating objects from the classes.
In OOP everything is an object.
Arpit Deo (Assistant Professor, Medi-Caps University, Indore)
Why OOP?
• One of the principal advantages of object-oriented programming
techniques over procedural programming techniques is that they
enable programmers to create modules that do not need to be changed
when a new type of object is added.
• A programmer can simply create a new object that inherits many of
its features from existing objects.
• This makes object-oriented programs easier to modify.

Arpit Deo (Assistant Professor, Medi-Caps University, Indore)


Characteristics
• characteristics of OOP’s
• Object
• Class
• Encapsulation
• Abstraction
• Inheritance
• Polymorphism
Arpit Deo (Assistant Professor, Medi-Caps University, Indore)
Objects
• Objects are basic building blocks for designing programs.
• An object is a collection of data members and associated member
functions.
• Object is instance of the class.
• An object may represent a person, place or a table of data.
• Each object is identified by a unique name.
• Each object must be a member of a particular class.
• Example: iphone11, Samsung Galaxy 10, OnePlus 7 are the objects of
the Mobile class.
Arpit Deo (Assistant Professor, Medi-Caps University, Indore)
Classes
• The objects can be made user-defined data types with the help of a class.
• “A class is a collection of objects that have identical
properties, common behavior and shared relationship.”
• Once the class is defined any number of objects of that class is created.
• Classes are user-defined data types.
• A class can hold both data and functions.
• For example planets, sun and moon are the members of the solar system class or
• BMW X1, Audi Q7, Toyota Fortuner are the members of the CAR class.

Arpit Deo (Assistant Professor, Medi-Caps University, Indore)


Abstraction
• “Data abstraction refers to the process of representing essential
features without including background details or explanations.”
• when we ride a bike, we only know about how to ride bikes but can
not know about how it work? And also we do not know the internal
functionality of a bike.
• Another real life example of Abstraction is ATM Machine; All are
performing operations on the ATM machine like cash withdrawal,
money transfer, retrieve mini-statement…etc. but we can't know
internal details about ATM.

Arpit Deo (Assistant Professor, Medi-Caps University, Indore)


Encapsulation
• The wrapping of data and function into a single unit is called data encapsulation.
• Data encapsulation enables data hiding and information hiding.
• Another example of encapsulation is a capsule. Basically, capsule encapsulate
several combinations of medicine. If combinations of medicine are variables and
methods then the capsule will act as a class and the whole process is called
Encapsulation.

Arpit Deo (Assistant Professor, Medi-Caps University, Indore)


Inheritance
“Inheritance = Reuse + Extend”
• Inheritance is the process by which one object can acquire and the use
of properties of another object.
• The existing class is known as a base class or superclass.
• The new class is known as a derived class or subclass.
• The derived class shares some of the properties of the base class.
Therefore a code from a base class can be reused by a derived class.

Arpit Deo (Assistant Professor, Medi-Caps University, Indore)


Polymorphism
• The ability of an operator and function to take multiple forms are
known as polymorphism.
• The different types of polymorphism are operator overloading and
function overloading.

Arpit Deo (Assistant Professor, Medi-Caps University, Indore)


Polymorphism

Arpit Deo (Assistant Professor, Medi-Caps University, Indore)


OOP Applications
Main application areas of OOP are:
• User interface design such as windows, menu.
• Real Time Systems
• Simulation and Modeling
• Object oriented databases
• AI and Expert System
• Neural Networks and parallel programming
• Decision support and office automation systems etc.
Arpit Deo (Assistant Professor, Medi-Caps University, Indore)
OOP
OOP v/s POP POP
OOP takes a bottom-up approach in designing a
POP follows a top-down approach.
program.
Program is divided into objects depending on the Program is divided into small chunks based on the
problem. functions.
Each object controls its own data. Each function contains different data.
Focuses on security of the data irrespective of the
Follows a systematic approach to solve the problem.
algorithm.
The main priority is data rather than functions in a
Functions are more important than data in a program.
program.
The functions of the objects are linked via message Different parts of a program are interconnected via
passing. parameter passing.
Access control is supported via access modifiers.
No access modifiers are supported.
(public, private and protected).
Encapsulation is used to hide data. No data hiding present. Data is globally accessible.
Inheritance is allowed in OOP. No such concept of inheritance in POP.
Operator overloading is allowed. Operator overloading is not allowed.
C++, Java. C, Pascal, Fortran.

Arpit Deo (Assistant Professor, Medi-Caps University, Indore)


Benefits of OOP:
• It is easy to model a real system as real objects are represented by programming
objects in OOP. The objects are processed by their member data and functions. It is
easy to analyze the user requirements.
• With the help of inheritance, we can reuse the existing class to derive a new class
such that the redundant code is eliminated and the use of existing class is extended.
This saves time and cost of program.
• In OOP, data can be made private to a class such that only member functions of the
class can access the data. This principle of data hiding helps the programmer to
build a secure program that can not be invaded by code in other part of the program.

Arpit Deo (Assistant Professor, Medi-Caps University, Indore)


Benefits of OOP:
• With the help of polymorphism, the same function or same operator
can be used for different purposes. This helps to manage software
complexity easily.
• Large problems can be reduced to smaller and more manageable
problems. It is easy to partition the work in a project based on objects.
• It is possible to have multiple instances of an object to co-exist
without any interference i.e. each object has its own separate member
data and function.
Arpit Deo (Assistant Professor, Medi-Caps University, Indore)
Object oriented programming
languages:
• CPP • Smalltalk
• C# • Ruby
• Java • PHP
• Python • Fortran2003
• Simula

Arpit Deo (Assistant Professor, Medi-Caps University, Indore)


Thank
You…
Arpit Deo (Assistant Professor, Medi-Caps University, Indore)

You might also like