• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

What is polymorphism?

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the answer for the following question :

What does polymorphism mean?
Choice 1
Dynamic selection of underlying proxies
Choice 2
A class can have different behavior depending on its runtime type.
Choice 3
A clever form of inheritance
Choice 4
It is another name for the Object-Oriented paradigm.
Choice 5
Dynamic behind the scene code conversion (for example, byte codes to native machine
code)
 
Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"A class can have different behavior depending on its runtime type. "

Although I would rephrase it,

"An object can have different behavior depending on its runtime type. "

Polymorphism is the functionality of behing able to assign an instance of a subtype of a class, to a reference variable of any of its superclasses.

// Andreas
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Puja, please QuoteYourSources <--link
 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Folks...

Just for further clarification. In page 157 of the Keith Sarah and Bates book for SCJP 6, the following is mentioned as the last point under the heading 'Polymorphism':

Polymorphic method invocations apply only to overridden instance methods.

Can this be taken to mean that each time we override a methd, it's polymorphism at work? Hope someone can clarify. Thanks.

 
Ranch Hand
Posts: 394
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Varnam Aayiram wrote:Hi Folks...
Just for further clarification. In page 157 of the Keith Sarah and Bates book for SCJP 6, the following is mentioned as the last point under the heading 'Polymorphism':

Polymorphic method invocations apply only to overridden instance methods.

Can this be taken to mean that each time we override a methd, it's polymorphism at work?



Hello Varnam I will rather 'directly' relate the process of overriding to inheritance, polymorphism is a situation where an Object -thanks to inheritance- can be refered to by references of its type and its super classe's type.

HTH

Regards

Ikpefua.
 
Any sufficiently advanced technology will be used as a cat toy. And this tiny ad contains a very small cat:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic