Skip to content

Object Oriented Programming (OOP)

Abstraction

  • Hide the internal working of a given system. The client needs to work only with the interfaces.
  • Example: a car exposes the gas and brake pedals, but it doesn't matter to the driver what is happening on the enginer or the brake pads

Encapsulation

  • Data + Functions inside a container (for example, a class)
  • The data can be accessed via getters/setters to avoid exposing the information directly

Inheritance

  • Allows reusing classes and avoiding duplicity

Polymorphism

  • Override methods from parent classes
  • The returning value must have the same shape