Which of the following is a pillar of OOP?
2024
Which of the following is a pillar of OOP?
- A.
Inheritance
- B.
Encapsulation
- C.
Abstraction
- D.
More than one of the above
- E.
None of the above
Attempted by 702 students.
Show answer & explanation
Correct answer: D
Object-Oriented Programming (OOP) is based on four main pillars: Inheritance, Encapsulation, Abstraction, and Polymorphism. These principles help in organizing code, promoting reusability, and managing complexity. Inheritance allows a class to inherit attributes and methods from another class, enabling code reuse and hierarchical classification. Encapsulation bundles data and methods into a single unit, restricting direct access to some components to enhance security and modularity. Abstraction hides complex implementation details and exposes only essential features, simplifying interaction with objects. Polymorphism allows objects to take on many forms, enabling methods to behave differently based on the object type.