Please enable JavaScript.
Coggle requires JavaScript to display documents.
OOP - Coggle Diagram
OOP
Benefits of OOP
Improved Maintenance
- Easier to update code by modifying specific objects/classes.
- Changes don’t affect unrelated parts of the program.
Reusability
- Objects and classes can be reused across programs.
- Promotes modularity and efficiency.
Better Data Integrity
- Encapsulation prevents unauthorized access or accidental modification.
-
Object Persistence
- Objects retain their state and variables throughout the program’s lifecycle.
Core Features
Abstraction
- Hides complexity and shows only the relevant details.
- Example: Using a car without needing to know how its engine works.
Polymorphism
- Enables objects to take many forms.
- Example: A method
calculateSalary() behaves differently for a Manager and an
Encapsulation
- Combines data and methods in one entity.
- Protects internal data by restricting access (private, public, etc.).
- Prevents accidental changes by other parts of the program.
Inheritance
- Derived classes inherit attributes and behaviors from a base class.
- Promotes code reuse.
- Example: Base Class (Employee) → Derived Class (Manager, Intern).
-
Key Concepts of OOP
Classes
- Blueprint for objects.
- Models real-world entities.
- Example: Teacher, Student, Car.
Objects
- Instances of classes.
- Example: A specific teacher is an object of the Teacher cl