Encapsulation:
- Encapsulation means binding data Members and methods into a single unit with data Security.
- Encapsulation is used for Security purpose.
- The Data members of a class will be private and methods of class will be public by using this we can access the functionality of a class but can not alter data.
- Polymorphism means one thing performs different actions depending on Situation.
- For example: Aperson performs different actions:
Somtime laughing
Sometime crying
Sometime angry - Method overloading is a way to achieve polymorphism.