Object-oriented programming (OOP) is a computer programming model that organizes software design around data, or objects, rather than functions and logic. An object can be defined as a data field that has unique attributes and behaviour.
OOP focuses on the objects that developers want to manipulate rather than the logic required to manipulate them. This programming approach is well-suited for programs that are large, complex and actively updated or maintained.
Four Pillars of Object-Oriented Programming are listed below:
1. Inheritance
The real-life example of inheritance is child and parents, all the properties of the father are inherited by his son. They have the same features but are not the same, they are identical.
2. Polymorphism
An example of Polymorphism can be visualized by the duties performed by a Man. Man is only one, but he takes multiple roles like – he is a dad to his child, he is an employee, a brother and many more. This is known as Polymorphism.
3. Encapsulation
One of the real-world examples of encapsulation is Capsule, as capsule binds all its medicinal materials within it, similarly in java encapsulation units (class, interface, enums etc) enclosed all its data and behaviour within it.
4. Abstraction
We all use an ATM for cash withdrawal, money transfer, retrieve min-statement, etc in our daily life. But we don’t know internally what things are happening inside ATM when you insert an ATM card for performing and kind of operations.
Did you find it helpful? Let me know your thoughts in the comments below!
Let's connect!
You can follow me on Twitter, LinkedIn & GitHub
If you like this post. Kindly support me by Buying Me a Coffee
Top comments (1)
It wolud be good, if includes with coding example.