Tell me real world example of polymorphism and encapsulation .

Answer Posted / nagaraj

polymorphisms:-
polymorphisms is nothing but ability to take more than one forms(One Interface,Multiple Methods or One Name,Many Forms).

Encapsulation:-
-is nothing but wrapping the data and functions into single entity.

Inheritance:-
The Process of deriving new class from existing class.This is called Inheritance.
New Class-Child Class
Existing Class-Parent Class


Polymorphism:

say a door..
a door to a temple, a door to a house, a door to a kitty house,
all are doors, but all look different

Encapsultion:

cars and owners...
all the functions of cars are encapsulated with the owners..
No one else can access it...

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the minimum number of nodes that a binary tree can have?

571


Can we put null value in hashmap?

483


Is arraylist a collection?

518


Write the importance of hashing?

599


Explain binary representation?

490






How many types of data structures are used?

516


Write a program for Sorting an Array. Which sorting will you prefer?

582


How to find the missing element in integer array of 1 to 7?

522


What do you mean by structure property in a heap?

530


Why would you use a linked list?

464


Explain set interface?

569


List the two important key points of depth first search?

699


Which is better arraylist or linkedlist?

456


Why heap sort is not used?

476


Which is faster array or arraylist?

465