Wrox Programmer Forums
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 28th, 2006, 08:12 AM
Registered User
 
Join Date: Oct 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to pavanonforums
Default need of polymorphism?

hi this is pavan new to his group and I have justcompleted my MCA and looking for opening.I attended for 3 interviews the common question they asked is
what is the use of polymorphism?give one suitable realtime example?

please help me


thanks in advance


Reply With Quote
  #2 (permalink)  
Old October 30th, 2006, 08:23 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 103
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Geo121
Default

Well this disappoints me . . .
You have a masters in computer science or computer applications yet you aren't sure of a suitable answer for polymorphism???

Well . . . I will help you out.

Polymorphism is one of the most important and most valuable concepts of programming.
Polymorphism literally means "many forms".
which means the data can be represented in multiple forms.
Even though classes are derived or inherited from the same parent class, each derived class will have its own behavior.
Polymorphism is a concept linked to inheritance and assures that derived classes have the same functions even though each derived class performs different operations.
An example would be if you had a class animal
all animals comunicate in some form just i different ways so you would have an abstract function declared in the parent class talk()
This function will now use polymorphism by example of a dog the dog would inherit this function talk but the dogs talk() function would be different.
animal.talk()
{
    cout << "spoke";
}
dog.talk()
{
    cout << "bark";
}
I hope this helps you but I am kinda upset of course your subject is kinda generalized I don't think a master of computer science should be getting advice on how to pass an interview from an 17 year old high school student. Sorry if this is rude but its just my opinion and doesn't matter right?

 ~ Geo
Reply With Quote
  #3 (permalink)  
Old October 30th, 2006, 08:26 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 103
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Geo121
Default

http://p2p.wrox.com/topic.asp?TOPIC_ID=51529

above is a link to a form subject that is using a little bit of polymorphism

it's not the best example because it has an error and it is not the best example of polymorphism but this is still a good start

 ~ Geo
Reply With Quote
  #4 (permalink)  
Old December 7th, 2016, 06:19 AM
Registered User
 
Join Date: Dec 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Polymorphism

This may Help : Polymorphism
Thanks!
Reply With Quote
  #5 (permalink)  
Old February 22nd, 2018, 03:36 AM
Registered User
 
Join Date: Feb 2018
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Take a look at this maybe it'll help you out real significance(use) of polymorphism
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with Polymorphism Piash Java Basics 1 August 8th, 2007 05:24 AM
What is Interface Polymorphism in C#? ramk_1978 C# 1 May 3rd, 2006 01:23 AM
Polymorphism->overloading? naveen J2EE 2 October 19th, 2005 02:34 AM
Polymorphism with Interfaces digby_dog VB.NET 2002/2003 Basics 2 May 11th, 2005 12:50 PM
Polymorphism and Casts g_r BOOK: Beginning Java 2 1 July 13th, 2003 08:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.