CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.




Get it now !!
Send your Resume to 6000 Companies

Search Interview Questions

Question: Real life examples of polymorphisms, encapsulation and inheritance?

Answer: 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

Types:
*Single Inheritance
*Multiple
*Hybrid
*Multilevel
*Hierarchical





Category C# Interview Questions & Answers - Exam Mode / Learning Mode
Rating (3.5) By 74 users
Added on 6/19/2013
Views 2145
Rate it!
Question: Real life examples of polymorphisms, encapsulation and inheritance?
Answer:

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

Types:
*Single Inheritance
*Multiple
*Hybrid
*Multilevel
*Hierarchical



Source: CoolInterview.com

Answered by: krishnasamy | Date: 6/19/2008 | Contact krishnasamy Contact krishnasamy

Hey, It asks for real world examples...

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...


Inheritence:

Kingfisher jet
^
|
Airplane
^
|
Flying Things
Source: CoolInterview.com

Answered by: Jk | Date: 7/1/2008 | Contact Jk Contact Jk

polymophism ...good example is when dog smells a cat it will barkand run after it but when it smells food it it will salivate and run to its bowl.ie .sence of smell is at work in both situations but action depends upon what it smells. Source: CoolInterview.com

Answered by: raseeka | Date: 3/16/2009 | Contact raseeka Contact raseeka

polymorphism:
Poly = many
morphs = forms
existing in many forms.
It is achieved by OVERLOADING and OVERRIDING.

EXAMPLE: We behave diffrently in front of elders, and friends.
a single person is behaving diffrently at diffrent time.

ENCAPSULATION:
Wrapping up data and member functions in a single unit for easier and safer access.

INHERITANCE:
A new class(child) can be based on existing class(parent) deriving functionallity from parent class. Source: CoolInterview.com

Answered by: Prasana J | Date: 4/16/2009 | Contact Prasana J Contact Prasana J

Polymorphisam: An Object is in different forms and in each form its exhibit the same functionality but the implementation is different.

Eg: A Person who knows more than two languages he can speak in a language which he knows. Here person is Object and speak is polymorphisam.

Inheritance: The process of eqiring the existing functionality of parent and with new added features and functionality of a child Object.

A secintific calculator is a extend form of Caluculator here Caluculator is parent and secintific calculator is Child object.

Encapsulation: Binding of data and behavior i.e functionality of an object in a secured and controlled manner. Source: CoolInterview.com

Answered by: Nageswara Rao | Date: 8/13/2009 | Contact Nageswara Rao Contact Nageswara Rao

real life exam :
polymorphisam.it is phenominal used for one interface multiple function. girl like a friend,girlfiriend,daughter
inhertance.it is a property in which derived class inherits feauters of base class.like father and son
encapsulation.encapsule only relevent information.line vaccum cleaner Source: CoolInterview.com

Answered by: sunil | Date: 4/7/2010 | Contact sunil Contact sunil

IT IS REALLY GOOD QUESTION

POLYMORPHISAM MEANS HAVE SAME FORMS WITH DIFFERENT METHODS

EXAMPLE MAN EAT FOOD, MAN DRINK WATER.

HERE MAN IS THE FORM HAVING WITH SAME NAME
FOOD AND WATER IS THE METHODS


ENCAPSULATION MEANS HIDING ALL THE INTERNAL DETAILS OF THE METHODS.

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

INHERITANCE MEANS A CHILD CLASS USE THE ALL THE ELEMENTS IN THE PARENTS CLASS.

DAD
||
CHILED Source: CoolInterview.com

Answered by: rajeshkumarreddy challa | Date: 5/18/2010 | Contact rajeshkumarreddy challa Contact rajeshkumarreddy challa

EX OF POLYMORPHISM:
A TEACHER BEHAVES TO STUDENTS
A TEACHER BEHAVES TO HIS/HER SENIORS
HERE TEACHER IS AN OBJECT BUT ATTITUDE IS DIFFERENT IN DIFFERENT SITUATIONS Source: CoolInterview.com

Answered by: Manjog Padhy | Date: 7/27/2010 | Contact Manjog Padhy Contact Manjog Padhy

polymorphism: poly=many
morphism=forms
i.e one interface having many methods.
human being
encapsulation: hiding the information of essential detalis.
inheritance: the process of deriving one class from parent class.
Source: CoolInterview.com

Answered by: tejaswini | Date: 8/3/2010 | Contact tejaswini Contact tejaswini

Polymorphism means ability to take more than one form thats an operation can exhibit different behavior at different instance depend upon the data passed in the operation
the real life example
A software engineer can perform different task at different instance of time depending on the task assign to him
he can done coding , testing , analysis and designing depending on the task assign and the requirement Source: CoolInterview.com

Answered by: Deepesh Yadav | Date: 8/30/2010 | Contact Deepesh Yadav Contact Deepesh Yadav


If you have the better answer, then send it to us. We will display your answer after the approval

Rules to Post Answers in CoolInterview.com:-

  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.

Post your answer here

Inform me about updated answers to this question.
Related Questions
View Answer
What is partial class. & what is advantage.
View Answer
What is the name of c#.net compiler?
View Answer
What is an object?Define a class.
View Answer
Define abstraction,encapsulation,inheritance:with example.
View Answer
Define abstraction,encapsulation,inheritance:with example.
View Answer
What is mean "Death of Diamod"?
View Answer
what is the main difference between delegate and an event in c#?
View Answer
How to use HASH TABLE,ARRAYLIST in c# explain with example?
View Answer
Assemblies are of the following types:

View Answer
What is the difference between shadow and override

View Answer
What is the top .NET class that everything is derived from?

View Answer
C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write?

View Answer

Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

View All C# Interview Questions & Answers - Exam Mode / Learning Mode




India News Network
Latest 20 Questions
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
"Holiday Packages" announced as an advertisement are an example of _________: (a) Offer (b) Counter Offer (c) Invitation to Offer (d) None of the above
A match fixing contract between a player and a broker is a: (a) Valid Contract (b) Unenforceable Contract (c) Void Contract (d) Illegal Contract
When a bookseller sells a book on cash payment then it is called as ___________: (a) Unilateral Contract (b) Bilateral Contract (c) Executed Contract (d) Executory Contract
____________ agreements are created by situation: (a) Written (b) Oral (c) Void (d) Implied
Cache = 0 Seconds