Skip to content

Object oriented programming

What are the four principles of OOP?

  1. Encapsulation - Bundling methods into a single unit and restricting access.
  2. Abstraction - Hiding implementation details and exposing only the necessary parts of an object.
  3. Inheritance - Creating a new class based on an existing class, allowing for code reuse and the creation of hierarchical relationships.
  4. Polymorphism - Different classes treated as the same type through a common interface, allowing for flexibility and the ability to define methods in different ways.