Four Pillars Of OOPS | Good Daily Life Examples : POST 4

 


  • The Four Pillars of OOPS are : 
    • Encapsulation.
    • Inheritance.
    • Abstraction.
    • Polymorphism.
  • Now on going to individual explanation .Don't stop reading if you confused ,there are examples which helps you to understand more.

  1. Encapsulation : Encapsulation is nothing but binding of some variables and the functions which related to those variables in same Class . 
    •  For eg., All students in a class forms a WhatsApp group now these students were bind together with other students and their activities . Here WhatsApp group provides                  encapsulation for both students and their activities.
    • For eg., In our human body our parts like heart, lungs, kidneys, stomach are packed together ,so that every part functions and co-operates with each other to maintain us healthy. Here, our body provides encapsulation for all our inner parts. 
  2. Inheritance  : Inheritance is  another useful feature of OOPS where we can reuse the existing information in a class .
    • For eg., When a student passed an academic year he can use the formulas learned in old academic year to solve the problems in current academic year , Thus he used inheritance concept in his life.
    • For eg., We know first invention of human is wheel ,later he used this wheel property to prepare small cart ,after he used this cart property and added engine to prepare car. Thus he directly inherited wheel property to cart ,cart property to car and indirectly inherited wheel property to car.
  3. Abstraction : Abstraction is one main feature of OOPS which provides privacy or avoid others to get contact with the information of Class.
    • For eg., In a WhatsApp group the persons from outside cannot join without the permission of group members ,here the group is using the concept of abstraction like they are hiding all details from outside people
    • For eg., We said before that our human body follows inheritance, Human body also posses abstraction feature, like we cannot see the activities done by our cells in body .So our body abstracts the activities of our cells from our eyes.    
  4. Polymorphism : Polymorphism is one main useful feature of OOPS where we can use same thing for multi-purposes in different ways.
    • For eg., Now a days iphones are designed in such a way it has only one port for charging as well as ear phone plug . Thus iphone designers using same port for multi-purposes with concept of Polymorphism
    • For eg., You might notice in youtube there is subscribe button for every channel .We can lick on it to subscribe at the same time we use same button to unsubscribe . Thus subscribe button in youtube shows property of polymorphism.

  • Please comment the examples that you known in comment box 

Guys if you have any doubts, please let me know

Post a Comment (0)
Previous Post Next Post

How to start Coding | coding for beginners | Lecture 1