Advertisements
Advertisements
Question
State any six principle advantages of object oriented programming.
Long Answer
Advertisements
Solution
Advantages of Object-Oriented Programming are as follows:
- Encapsulation/data hiding: It bundles data and methods together and uses access modifiers (like private/public) to protect data.
- Modularity: By breaking a program into autonomous objects, it becomes easier to manage and troubleshoot.
- Reusability (Inheritance): Inheritance allows you to use existing code as a base for new features without rewriting everything.
- Polymorphism: It allows different classes to be treated through the same interface, making the code more flexible.
- Maintainability: Because code is modular and encapsulated, fixing a bug in one “object” is less likely to break the rest of the system.
- Abstraction: It focuses on what an object does rather than how it does it, simplifying the user’s interaction with the code.
shaalaa.com
Is there an error in this question or solution?
2023-2024 (July) Official Board Paper
