Software Development

What are the four pillars of object oriented programming?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

  • Abstraction - you don't need to know how this class implemented. You need to know what functionality does it provide (interface) and how to use it
  • Encapsulation - keep fields for class purposes private (or protected) and provide public methods if needed. We must keep the data and code safe within the class itself
  • Inheritance - gives ability to create class that shares some of attributes of existing classes
  • Polymorphism - same methods in different contexts can do different things. Method overloading and overriding are some forms of polymorphism