Member-only story

Basic Concepts of OOP

Nipuni Arunodi
2 min readSep 6, 2020

--

Photo by Michiel Leunens on Unsplash

Object-oriented is based on a couple of main concepts as follows:

  • Abstraction
  • Encapsulation
  • Inheritance
  • Polymorphism

Inheritance

  • Inheritance is the process of forming a new class from an existing class.
  • The objects of the new class inherit the features of the existing class and redefine them or add new ones.
  • This is also called a “is a” relationship:

Polymorphism

  • Polymorphism means ‘the ability to take many forms’.
  • It allows different objects to respond to the same message in different ways.
  • The response is specific to the type of the object.

Abstraction

  • Abstraction refers to the act of representing essential features without including the background details or explanations

Encapsulation

  • Encapsulation is the mechanism that binds together methods and the data it manipulates and keeps both safes from outside interference and misuse.

--

--

No responses yet