KASA
Back to interview Q&A
Computer Science FresherOOPbeginner

What are the four pillars of object-oriented programming?

A basic CS interview question asked in fresher, Java, Python, and backend interviews.

0
Asked by KASA community7 Jul 20261 view
KASA answer
The four pillars of object-oriented programming are encapsulation, abstraction, inheritance, and polymorphism. Encapsulation means keeping data and methods together and controlling access. Abstraction means showing only essential details and hiding unnecessary complexity. Inheritance allows one class to reuse or extend another class. Polymorphism allows the same interface or method name to behave differently depending on the object or implementation. A strong answer should include a simple example, such as a Payment interface with CardPayment and UPIPayment implementations.
Cover these points
  • Encapsulation controls access to data.
  • Abstraction hides implementation details.
  • Inheritance reuses and extends behavior.
  • Polymorphism allows different implementations through a common interface.
  • Give a practical example.

Community answers

0 approved answers

Add answer

No approved community answers yet

Add a clear answer with examples. It will appear after moderation.

Question discussion

Comments and follow-ups

No approved comments yet. Add useful context or ask a follow-up.

Login to join the discussion

Write an answer

Add a practical answer with examples, edge cases, project experience, and points a fresher can speak in an interview.

Login required. Your answer will be connected to your account and sent for moderation.

Keep practising

Related interview questions

Browse all