By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,264 Members | 1,824 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,264 IT Pros & Developers. It's quick & easy.

define polymorphism

P: n/a
polymorph just means "many form(s)".
The definition in plain English

http://www.bartleby.com/61/66/P0426600.html

and narrower definitions in the context of computer programming

http://en.wikipedia.org/wiki/Polymorphism
http://wombat.doc.ic.ac.uk/foldoc/fo...&action=Search

don't really help us understand what polymorphism means
in the context of the C++ computer programming language.

Simple operator overloading could be polymorphism.
Generic programming with templates could be polymorphism.
Or polymorphism may be restricted specifically
to run-time (dynamic binding) of a function call to it's implementation
(virtual functions).
Jul 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
In general usage of the term, it refers to inheritance with runtime
binding.

The Liskov Substitution Principle would be a good explaination of
polymorphism:
http://www.eventhelix.com/RealtimeMa..._principle.htm

Deepa
--
http://www.EventHelix.com/EventStudio
EventStudio 2.5 - Generate Sequence Diagrams from plain text input

Jul 22 '05 #2

P: n/a
E. Robert Tisdale wrote:
polymorph just means "many form(s)".
The definition in plain English

http://www.bartleby.com/61/66/P0426600.html

and narrower definitions in the context of computer programming

http://en.wikipedia.org/wiki/Polymorphism
http://wombat.doc.ic.ac.uk/foldoc/fo...&action=Search
don't really help us understand what polymorphism means
in the context of the C++ computer programming language.

Simple operator overloading could be polymorphism.
That's not considered to be polymorphism.
Generic programming with templates could be polymorphism.
That is sometimes called "compile-time polymorphism".
Or polymorphism may be restricted specifically
to run-time (dynamic binding) of a function call to it's implementation
(virtual functions).


This is what is usually meant by the term "polymorphism".
Jul 22 '05 #3

P: n/a
E. Robert Tisdale wrote:
polymorph just means "many form(s)".
The definition in plain English
[url]
and narrower definitions in the context of computer programming
[urls]
don't really help us understand what polymorphism means
in the context of the C++ computer programming language.

Simple operator overloading could be polymorphism.
Generic programming with templates could be polymorphism.
Or polymorphism may be restricted specifically
to run-time (dynamic binding) of a function call to it's
implementation (virtual functions).


I liked the wiki's description. It would put overloading as a form of
ad-hoc polymorphism, templates as parametric polymorphism, and virtual
functions as subtyping polymorphism.

I have heard templates referred to as "parametric polymorphism" in a
lot of places. Stroustrup does it on page 347 of TC++PL, and Google
gives a lot of matches for (templates "parametric polymorphism"). So
that seems already to be accepted.

The wiki's terminology of "ad hoc polymorphism" for overloading is
something I had never heard before, though. It doesn't really feel like
polymorphism to me. I usually consider overloading to be syntactic
sugar, if very useful syntactic sugar.

--
Dave O'Hearn

Jul 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.