Repaso
EspaƱol
Design & PracticesFoundationsDP-57

Which list contains the four classic pillars of OOP?

Options

  1. Encapsulation, abstraction, inheritance, polymorphism (Correct option)
  2. Compilation, linking, loading, execution
  3. Frontend, backend, database, cloud
  4. 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.

Key terms

Practice this question in Repaso