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

Object Oriented Programming

Uploaded by

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

Object Oriented Programming

Uploaded by

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

Object Oriented

Programming
Object-Oriented Programming (OOP) is a powerful
programming paradigm that focuses on creating objects -
instances of classes - to model real-world entities and their
interactions. This approach offers numerous benefits, including
encapsulation, inheritance, and polymorphism, which enhance
code reusability, maintainability, and flexibility.
By Group 8
Bikrant Lekhak
Bidith Aryal
Binamra Bhandari
Binayak Chaudhary
Binod Chapagain
What is an Object?
Definition Characteristics
An object is an instance of Objects have properties
a class, representing a (attributes) and methods
specific entity with its own (behaviors) that define
unique data and their state and
behaviors. functionality.

Real-world Example
A car object might have properties like make, model, and
color, and methods like start, accelerate, and brake.
What is a Class?
Definition Characteristics Example

A class is a blueprint or template Classes encapsulate data and A "Car" class could define
that defines the common functionality, and serve as the properties like make, model, and
properties and behaviors of a blueprint for creating objects. color, and methods like start,
group of objects. accelerate, and brake.
Encapsulation: Hiding
implementation details

1 Definition 2 Benefits
Encapsulation is the Encapsulation promotes
principle of hiding the data abstraction,
internal implementation information hiding, and
details of an object from modularity, improving
the outside world. code maintainability and
flexibility.

3 Example
A "Car" class could have private variables for engine details
and public methods for starting and driving the car.
Polymorphism: One interface,
multiple implementations

1 Definition
Polymorphism allows objects of different classes to be
treated as objects of a common superclass.

2 Benefits
Polymorphism enables code reuse, flexibility, and the ability
to write generic, extensible methods.

3 Example
A "Vehicle" class could have a common "move()" method,
implemented differently by "Car", "Bike", and "Boat"
subclasses.
Abstraction: Focusing on essential
features

Definition
Abstraction is the process of focusing on the essential features and behaviors of an
object, hiding unnecessary details.

Benefits
Abstraction simplifies complex systems, improves code organization, and promotes
reusability and modularity.

Example
A "Vehicle" abstract class could define the essential features of all vehicles, like "move()" and "s
Inheritance: Reusing code and
extending functionality

Definition
Inheritance allows a new class to be based on an existing
class, inheriting its properties and methods.

Benefits
Inheritance promotes code reuse, extensibility, and the
creation of hierarchical relationships between classes.

Example
A "ElectricCar" class could inherit from the "Car" class, adding
new properties and methods.
Real-world examples of OOP
Object Class Encapsulati Polymorphi Abstraction Inheritance
on sm

Smartphone Phone Private Different Focusing on Smartphon


hardware phone essential e inheriting
and models features from basic
software with like calling, Phone class
component common texting,
s "call()" and and web
"text()" browsing
methods
Car Vehicle Private Different Focusing on Electric Car
engine and types of essential inheriting
other vehicles features from Car
internal with like driving class
component common and
s "move()" transportin
and g
"stop()" passengers
methods

You might also like