• 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Polymorphic method invocations apply only to overridden instance methods.

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
K & B say

"Polymorphic method invocations apply only to overridden instance methods." (last line P 153 in Ch. 2 Two Minute Drill).

My university notes say

"It is common for instances of unrelated classes to have the same message in their protocols, and instances of those classes may or may not respond differently to that message. Such messages are termed polymorphic messages"

Who is correct?

Thanks

W
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Wyn Riley:
..."It is common for instances of unrelated classes to have the same message in their protocols, and instances of those classes may or may not respond differently to that message. Such messages are termed polymorphic messages"...


I've never seen that definition before.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The notes seem a little confusing to me (I find the terminology a little strange), but the answer all kind of depends on your definition of polymorphism.

I did a search and this article had this to say:


Three distinct forms of polymorphism
From a practical programming viewpoint, polymorphism manifests itself in three distinct forms in Java:

* Method overloading
* Method overriding through inheritance
* Method overriding through the Java interface



The notes seem to be referring to polymorphism in the form of method overloading (sometimes called compile-time polymorphism), whereas K&B are talking about method overriding (sometimes called runtime polymorphism).

For your purposes, it's probably best to keep in mind K&B's usage.
 
Run away! Run away! Here, take this tiny ad with you:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic