insights: What is OOP (Class 12)
What is OOP (Class 12)

Object-Oriented Programming (OOP) is a programming model that organizes software design around objects rather than functions and logic. In OOP, we need to understand classes and objects.
- Objet: A real-world entity that has attributes (properties) and behaviours methods/functions).
- Class: It is a blueprint or template used to create objects.
Example:
- Class: Car
- Objects: MyCar, YourCar
- Attributes: color, model, speed
- Methods: start(), stop(), accelerate()
Key Concepts of OOP
- Class: Blueprint for creating objects.
- Object: Instance of a class.
- Encapsulation: Wrapping data (attributes) and methods in a single unit (class). Helps in data hiding.
- Inheritance: Acquiring properties and methods from another class.
- Polymorphism: The Same function/method can behave differently in different contexts.
- Abstraction: Hiding unnecessary details and showing only the important features.
Types of OOP / Inheritance
Inheritance is a key part of OOP. It allows a class to inherit attributes and methods of another class. There are several types:
Single Inheritance
- A class inherits from one parent class.
- Example:
class Vehicle:
def start(self):
print(“Vehicle started”)
class Car(Vehicle):
pass
c = Car()
c.start() # Output: Vehicle started
Multiple Inheritance
- A class inherits from more than one parent class.
- Example:
class Engine:
def engine_type(self):
print(“V6 Engine”)
class Wheels:
def wheel_count(self):
print(“4 wheels”)
class Car(Engine, Wheels):
pass
c = Car()
c.engine_type()
c.wheel_count()
Multilevel Inheritance
- A class inherits from a class that itself inherits from another class (like a chain).
- Example:
class Vehicle:
def vehicle_type(self):
print(“Generic Vehicle”)
class Car(Vehicle):
def car_type(self):
print(“Car”)
class SportsCar(Car):
pass
s = SportsCar()
s.vehicle_type()
s.car_type()
Hierarchical Inheritance
- Multiple classes inherit from one parent class.
- Example:
class Vehicle:
def start(self):
print(“Vehicle started”)
class Car(Vehicle):
pass
class Bike(Vehicle):
pass
c = Car()
b = Bike()
c.start() # Vehicle started
b.start() # Vehicle started
Hybrid Inheritance
- A combination of two or more types of inheritance (single, multiple, multilevel).
- Often used in complex programs.
Advantages
- Reusability of code (inheritance).
- Easier to maintain and debug.
- Models real-world problems better.
- Security through encapsulation.
Example Languages
- Java, C++
- Python
- C#
- Ruby
Read Online or Download the Slide.
Thank you for your view on OOP.
Also read:
Price of Samsung Mobile in Nepal 2025

