(OOP)
What is Object Oriented Programming (OOP)?
Object-Oriented Programming (OOP) is a programming paradigm that organizes software design around objects — entities that combine data (attributes) and behavior (methods). It models real-world entities and promotes modularity, reusability, and maintainability in code.
At its core, OOP uses classes as blueprints to create objects. A class defines the structure (attributes) and capabilities (methods) of its objects, while each object is an instance with its own state.
Key Concepts
- Class – A template or a blueprint that define attributes and methods.
- Object – An instance of a class with specific data.
- Attributes – Variables that store the state of an object.
- Methods – Functions inside a class that define object behavior.
OOP Principles
- Encapsulation – Bundling data and methods, restricting direct access to internal state.
- Abstraction – Hiding complex implementation details, exposing only necessary functionality.
- Inheritance – Allowing a class (child) to acquire properties and behaviors from another (parent).
- Polymorphism – Enabling the same method name to behave differently based on the object.
Benefits of OOP
- Code Reusability via inheritance.
- Modularity for easier debugging and maintenance.
- Security through encapsulation.
- Flexibility with polymorphism for adaptable behaviors.
