Principles of OOP

Venushi Kavitha De silva
2 min readMay 29, 2021

--

OOP stands for Object Oriented Programming. It is a computer programming model that organizes software design around data, or objects, rather than functions and logic. In this article, I will try to explain the main four principles of Object-Oriented-Programming (OOP).

There are 4 major principles that make an language Object Oriented. These are Encapsulation, Abstraction, Inheritance, and Polymorphism.

Encapsulation

Encapsulation is achieved when each object within a class retains a private state. Other objects cannot directly access this state; instead, they must use a list of public functions. These functions allow the object to control its own state, and no other class can change it unless it is explicitly allowed. You must use the methods supplied in order to communicate with the object.

Abstraction

Encapsulation is an extension of abstraction. It is the process of picking data from a bigger pool in order to display only the object’s relevant details. Also the process of fetching/removing/selecting the user information from a larger pool is referred to as Abstraction.

Inheritance

One of the key notions of object-oriented programming (OOP) languages is inheritance. It’s a way for deriving a class from another class in a hierarchy of classes with similar characteristics and functions. It can be used to specify many types of exceptions, to add custom logic to existing frameworks, and even to map your domain model to a database.

Polymorphism.

Polymorphism permits us to carry out the same activity in multiple ways. Polymorphism, in other terms, allows you to specify a single interface with various implementations. The words “poly” and “morphs” both imply “many,” therefore it means “many forms.”

--

--