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

Chapter - 2 Oops

This document discusses object-oriented programming concepts including procedural vs object-oriented programming, principles of OOP like encapsulation, inheritance, polymorphism and abstraction, and benefits and applications of OOP. The key concepts are: 1) OOP is a programming paradigm that represents everything as objects that contain data and functions. Classes are templates for objects. 2) The main principles of OOP are encapsulation, inheritance, polymorphism and abstraction. Encapsulation binds data and functions together, inheritance allows code reusability, polymorphism means one task can be performed in different ways, and abstraction hides unnecessary details from the user. 3) Benefits of OOP include modularity, reusability

Uploaded by

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

Chapter - 2 Oops

This document discusses object-oriented programming concepts including procedural vs object-oriented programming, principles of OOP like encapsulation, inheritance, polymorphism and abstraction, and benefits and applications of OOP. The key concepts are: 1) OOP is a programming paradigm that represents everything as objects that contain data and functions. Classes are templates for objects. 2) The main principles of OOP are encapsulation, inheritance, polymorphism and abstraction. Encapsulation binds data and functions together, inheritance allows code reusability, polymorphism means one task can be performed in different ways, and abstraction hides unnecessary details from the user. 3) Benefits of OOP include modularity, reusability

Uploaded by

Vansh Mehta
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Chapter:2

Concepts of OOP:
Introduction OOP, Procedural Vs. Object Oriented
Programming, Principles of OOP,
Benefits and applications of OOP

prof.Arkesha Shah
Procedural Vs. Object Oriented Programming
OOPs Concepts

The programming paradigm where everything is represented as an object is


known as truly object-oriented programming language.

Smalltalk is considered as the first truly object-oriented programming language.

Object means a real word entity such as pen, chair, table etc.

Object-Oriented Programming is a methodology or paradigm to design a program


using classes and objects.
The main aim of OOP is to bind together the data and the functions that operate
on them so that no other part of the code can access this data except that
function.
the building blocks of OOPs
Class
The building block of C++ that leads to Object-Oriented programming is a Class.
A class is a blueprint or template of an object.
It is a user-defined data type.
Inside a class, we define variables, constants, member functions, and other
functionality.
it binds data and functions together in a single unit.
It does not consume memory at run time.
It is the best example of data binding.
For Example:
Object

An Object is an identifiable entity with some characteristics and behavior.

It contains member functions, variables that we have defined in the class

It occupies space in the memory.

Different objects have different states or attributes, and behaviors


consider an example

When a class is defined, no memory is


allocated but when it is instantiated (i.e. an
object is created) memory is allocated.
Defining Class and Declaring Objects

A class is defined in C++ using keyword class followed by the name of class.

The body of class is defined inside the curly brackets and terminated by a
semicolon at the end.
Declaring Objects:

To use the data and access functions defined in the class, you need to create
objects. Syntax:

ClassName ObjectName;
Abstraction

Abstraction helps in the data hiding process.

It helps in displaying the essential features without showing the details or the
functionality to the user.

It avoids unnecessary information or irrelevant details and shows only that specific
part which the user wants to see.
Polymorphism

When one task is performed by different ways i.e. known as polymorphism.

For example: to convince the customer differently,

It can be implemented using function overloading, operator overload, function


overriding, virtual function.
Encapsulation

The wrapping up of data and functions together in a single unit is known as


encapsulation.

It protects data and functions from outside interference and misuse.

Therefore, it also provides security. A class is the best example of encapsulation.


Inheritance

One of the most useful aspects of object-oriented programming is code reusability.

The concept allows us to inherit or acquire the properties of an existing class


(parent class) into a newly created class (child class).

It is known as inheritance.
Benefits of OOP

● Modular, scalable, extensible, reusable, and maintainable.


● It models the complex problem in a simple structure.
● Object can be used across the program.
● Provides security through encapsulation and data hiding features.
● Beneficial to collaborative development in which a large project is
divided into groups.
● Debugging is easy.
Applications of OOPs

● Computer graphics applications


● Object-oriented database
● User-interface design such as windows
● Simulation and modeling
● Client-Server System
● Artificial Intelligence System
● CAD/CAM Software
● Office automation system
Thank You…..

You might also like