Features and Concepts of OOP
Published by: Anil K. Panta
Features and Concepts of OOP
Classes
Blueprints for creating objects.
Example: A Car class defines properties like color and behaviors like start().
Objects
Instances of classes.
Example: A redCar object with color = red, model = Tesla.
Encapsulation
Hides internal details of objects.
Ensures data security and integrity.
Inheritance
Allows a class to inherit properties and methods from another class.
Example: SportsCar inherits from Car.
Polymorphism
One interface, multiple implementations.
Example: A Drive() function works for Car, Bike, and Bus.
Abstraction
Shows only essential features.
Hides internal logic.
Example: A Vehicle class with abstract methods like start() and stop().