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

Two linked lists are given, find out the sum of them without altering the linked list?

562


How to find middle element of linked list in one pass?

535


Is hashtable better than dictionary?

530


What's the difference between an array and vector?

506


Explain Stack

580






Why do we use hashmap?

535


How do stacks work?

513


List the types of rotations available in splay tree?

726


Explain exception filter?

546


What are skew trees? For a tree with 4 nodes draw all possible binary? Generalize for n nodes how many binary trees can be drawn?

634


What is significance of ” * ” ?

638


If you do not initialize an array what will happen?

600


How can we delete the first node from the singly linked list?

501


When is a binary search algorithm best applied?

661


How can we delete any specific node from the linked list?

511