|[22 earlier articles]|
|Re: Polymorphism vs. Overloading firstname.lastname@example.org (1994-10-27)|
|Re: Polymorphism vs. Overloading email@example.com (1994-10-28)|
|Re: Polymorphism vs. Overloading firstname.lastname@example.org (1994-10-28)|
|Re: Polymorphism vs. Overloading email@example.com (1994-10-29)|
|Re: Polymorphism vs. Overloading firstname.lastname@example.org (1994-10-29)|
|Re: Polymorphism vs. Overloading email@example.com (1994-11-01)|
|Re: Polymorphism vs. Overloading firstname.lastname@example.org (kanze) (1994-11-01)|
|Re: Polymorphism vs. Overloading davidm@Rational.COM (1994-10-31)|
|Re: Polymorphism vs. Overloading email@example.com (1994-11-01)|
|Re: Polymorphism vs. Overloading firstname.lastname@example.org (1994-11-01)|
|Re: Polymorphism vs. Overloading email@example.com (1994-11-02)|
|Re: Polymorphism vs. Overloading bimbart@CS.kuleuven.ac.be (Bart Demoen) (1994-11-02)|
|Re: Polymorphism vs. Overloading firstname.lastname@example.org (1994-11-01)|
|[2 later articles]|
|Date:||Tue, 1 Nov 1994 02:46:03 GMT|
Gabriela O. de Vivo <email@example.com> wrote:
>Last week I was invited to join a Thesis (MsC) presentation.
>At some point a question raised about the exact difference between
>Polymorphism and Overloading.
firstname.lastname@example.org (Joseph H Allen) writes:
|> The difference is purely syntactical. Calls to overloaded functions look,
|> well, like function calls. Calls to polymorphic functions require a dot or
|> '->' somewhere. Really, that's the only difference. Artificial semantic
|> restrictions placed by certain languages aside, you can always move the
|> identifier or address-expression from the left of the dot into the
|> parenthasis as the first argument to generate an equivelent overloaded
|> function call.
This is not the way I understand it. Basically, overloading is
(usually) resolved by the compiler, at compile time. Polymorphism
must be resolved at run-time; the compiler doesn't know which function
will actually be called.
The presence or absence of a dot or `->' signal only whether the
function called is a member function or a global function. In C++,
only member functions can be polymorphic; this may be the source of
some of the confusion. But this is a restriction of C++ (in common
with a lot of other languages), not of the concept of polymorphism.
Polymorphism (virtual functions in C++) and overloading are orthogonal
concepts: a function can be both polymorphic and overloaded, or just
polymorphic, or just overloaded, or none of the above.
James Kanze Tel.: (+33) 88 14 49 00 email: email@example.com
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Return to the
Search the comp.compilers archives again.