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
Two linked lists are given, find out the sum of them without altering the linked list?
How to find middle element of linked list in one pass?
Is hashtable better than dictionary?
What's the difference between an array and vector?
Explain Stack
Why do we use hashmap?
How do stacks work?
List the types of rotations available in splay tree?
Explain exception filter?
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?
What is significance of ” * ” ?
If you do not initialize an array what will happen?
How can we delete the first node from the singly linked list?
When is a binary search algorithm best applied?
How can we delete any specific node from the linked list?