sidtechtalks.in

Four Pillars

Object Oriented Programming

Flames

OOPS is a paradigm is essentially a bunch of rules that you follow when writing code, to help you solve a particular problem. That's what the four pillars are. They're software design principles to help you write clean Object-Orientated code.

What is OOPS?

Flames

1. Abstraction 2. Encapsulation 3. Inheritance 4. Polymorphism

Four Pillars

Flames

1. Abstraction

Flames

Abstraction is the process of showing only essential/necessary features  of an entity/object to the outside world and hide the other irrelevant information. For ex. to open your TV we only have a power button, It  is not required to understand how infra-red waves are getting generated  in TV remote control.

2. Encapsulation

Flames

Encapsulation means wrapping up data and member function (Method) together into a single unit i.e. class. We also called it Data Hiding which provides security to data by making the variable as private and expose the property to access the private data which would be  public.

3. Inheritance

Flames

Inheritance is the ability of one object to acquire some/all properties  of another object. For ex., a child inherits the traits of his/her parents. With inheritance, reusability is a major advantage. You can reuse the fields and methods of the existing class.

4. Polymorphism

Flames

Polymorphism gives us a way to use a class exactly like its parent so there is no confusion with mixing types. A subclass can define its own unique behavior and still share the same functionalities or behavior of its parent/base class.

Conclusion

Flames

I hope this has explained what the four pillars of object-oriented  programming are, and how they lead to cleaner and more robust code. I write the tech articles which help developers to boost their productivity. You can reach out to me here for other tech stuff.