define polymorphism

E

E. Robert Tisdale

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/foldoc.cgi?query=polymorphism&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).
 
R

Rolf Magnus

E. Robert Tisdale said:
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/foldoc.cgi?query=polymorphism&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".
 
D

Dave O'Hearn

E. Robert Tisdale said:
polymorph just means "many form(s)".
The definition in plain English

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.[/QUOTE]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,189
Messages
2,571,016
Members
47,616
Latest member
gijoji4272

Latest Threads

Top