Basic Object Oriented Programming Concepts

Azura Sakan Taufik
2 min readJun 20, 2020
Photo by Clément H on Unsplash

Object Oriented Programming, like the name, is a style of programming where we see each entity as an object that has properties and methods surrounding it.

Each object is created through a class, a blueprint for an object which contains all the definitions (properties and methods) of an object.

Concepts in OOP :

1.Encapsulation

Imagine a capsule, all that good stuff you need to cure a sickness is wrapped in a single capsule unit. The medicine iniside is not just one thing, rather it is made up of several medicine combined. The same also applies to OOP. All the properties and methods you need is encapsulated and seen as a single unit. The use of encapsulation is to prevent data to be accessible from other classes unless we let them to do so.

2.Abstraction

Abstraction is the practice to only let the necessary things to be seen. You don’t need to worry about the complexity of the code behind it. Simply knowing what function/method you need to call, and pass the parameters it needs (if any) and you’re ready to go!

3.Inheritance

This should be intuitive enough. This concept is telling us that a child/subclass can inherit methods that it’s parent has. This allows to create reusable properties and methods which we will not need to re-write whenever we create a new class. We simply just need to add other methods that are specific or unique to that class.

4.Polymorphism

Polymorphism, derived from the word ‘poly’ which means many and ‘morph’ which means form. When combined, it means many different forms, but I like to think of it as the ability of an object perform an action in many different ways. This is often done through overloading and overriding, thus the same method that is used, can output different things based on the object.

This is it for now, I hope you get the basic understanding. will try to add examples soon!

--

--