This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes real time and compile time polymorphism example conflict Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "real time and compile time polymorphism example conflict" Watch "real time and compile time polymorphism example conflict" New topic
Author

real time and compile time polymorphism example conflict

satya dasika
Greenhorn

Joined: Dec 06, 2011
Posts: 1
Hi,
My friend said the only example for real time polymorphism is over riding and for compile time its over loading.. is it true that no other example exists except for these?

Thanks,
Satya.
Stephan van Hulst
Bartender

Joined: Sep 20, 2010
Posts: 3065
    
    1

Polymorphism is a word used for various things. I think "compile time polymorphism" and "runtime polymorphism" are especially poor phrases, and make it appear that the two concepts are related. They are not.

You should just use the words "overriding" and "overloading".
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 4901
    
    7

satya dasika wrote:My friend said the only example for real time polymorphism is over riding and for compile time its over loading...

I'm totally with Stephan on this one; the term "compile-time polymorphism" is an oxymoron to me, and also doesn't describe method overloading precisely (although I am aware that the term is used that way).

Polymorphism (overriding) is about providing different behaviour; method overloading is usually about providing variants of the same behaviour, and is therefore a form of specialization. Overloaded methods will also typically share a lot of code; indeed they may well be the same code, just called with different defaults or with different primitive arguments.

satya dasika wrote:is it true that no other example exists except for these?

It depends what you mean by "example". In the general terms you describe, I would say that there's only one form of polymorphism, but I am admittedly old-school.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: real time and compile time polymorphism example conflict
 
Similar Threads
Inheritance and Polymorphism
polymorphism
Polymorphism and overloading
compile-time polymorphism
Difference between Polymorphism and Dynamic Method lookup