Which list contains the four classic pillars of OOP?
Options
- Encapsulation, abstraction, inheritance, polymorphism (Correct option)
- Compilation, linking, loading, execution
- Frontend, backend, database, cloud
- Confidentiality, integrity, availability, authentication
Answer
Encapsulation, abstraction, inheritance, polymorphism
Why
- Encapsulation: hide the internal data and let others use it only through methods.
- Abstraction: show only what is needed and hide the complexity.
- Inheritance: a class can reuse and extend another one (a Dog is an Animal).
- Polymorphism: different objects can answer the same method call in their own way (
speak()for Dog and Cat).
Interviewers ask for these four constantly.
Remember
Encapsulation, abstraction, inheritance, polymorphism.