Some real life Examples of Object-oriented programming (OOP) concept.
1 .Polymorphism :
The process of representing one form in multiple forms is known as Polymorphism.
Suppose if you are in class room that time you behave like a student, when you are in market at that time you behave like a customer, when you at your home at that time you behave like a son or daughter, Here one person present in different-different behaviors.
2. Abstraction :
Abstraction is the concept of exposing only the required essential characteristics and behavior with respect to a context.
Abstraction shows only important things to the user and hides the internal details, for example, when we ride a bike, we only know about how to ride bikes but can not know about how it work? And also we do not know the internal functionality of a bike.
Abstraction is ATM Machine; All are performing operations on the ATM machine like cash withdrawal, money transfer, retrieve mini-statement…etc. but we can't know internal details about ATM.
3. Encapsulation = Data Hiding + Abstraction.
Example - Looking at the example of a power steering mechanism of a car. Power steering of a car is a complex system, which internally have lots of components tightly coupled together, they work synchronously to turn the car in the desired direction. It even controls the power delivered by the engine to the steering wheel. But to the external world there is only one interface is available and rest of the complexity is hidden. Moreover, the steering unit in itself is complete and independent. It does not affect the functioning of any other mechanism.
4. Inheritance -
Example - Father gives his property to child , father got that properties from child’s grandfather , so child is the taker and father is giver , hence father works as a base class and child as derived class ,
• you can explain is that the child couldn’t give its property to father so Inheritance is one sided
• why it is needed? so you can explain like same properties needed in multiple class you need not to write multiple times
Process of representing one form in many ways.
Your behavior that is, u behave differently with different person in different place
I mean, to parents I'll be good son, and to a friend u r a buddy and u share things with him /her and to teachers u show some respect
. Here it behavior is goes on changing with people u meet.
Process of showing essential information to user and hide the rest
Think u have a car, and u are riding car now, when u apply break u know that car gone a stop but u don't know what is the process happened when u applied break
Thanks Rashmi for such a wonderful explanation
I need to know how we use this concept in programming.
There is interface,abstract class, static class and final class. Many people do not know how to use this concept and why? What are advantages and how this concept make our life happy in programming
I hope you understand my doubt regarding prove concept by practically rather than theortical