Related articles |
---|
[8 earlier articles] |
Re: Polymorphism vs. Overloading strohm@mksol.dseg.ti.com (1994-10-28) |
Re: Polymorphism vs. Overloading ryer@dsd.camb.inmet.com (1994-10-28) |
Re: Polymorphism vs. Overloading mac@coos.dartmouth.edu (1994-10-25) |
Re: Polymorphism vs. Overloading joe@sanskrit.ho.att.com (1994-10-31) |
Re: Polymorphism vs. Overloading geld@cs.sun.ac.za (1994-10-31) |
Re: Polymorphism vs. Overloading ram@cs.cmu.edu (Rob MacLachlan) (1994-10-25) |
Re: Polymorphism vs. Overloading billk@cs.ukans.edu (1994-10-31) |
Re: Polymorphism vs. Overloading Mike.Chapman@muc.de (Mike Chapman) (1994-10-31) |
Re: Polymorphism vs. Overloading jsm@id.dth.dk (1994-10-31) |
Re: Polymorphism vs. Overloading sofkam@rpi.edu (1994-10-31) |
Re: Polymorphism vs. Overloading andand@csd.uu.se (1994-10-26) |
Re: Polymorphism vs. Overloading dekker@dutiag.twi.tudelft.nl (1994-10-31) |
Re: Polymorphism vs. Overloading danhicks@aol.com (1994-10-31) |
[16 later articles] |
Newsgroups: | comp.compilers |
From: | billk@cs.ukans.edu (Bill Kinnersley) |
Keywords: | polymorphism |
Organization: | EECS Dept, University of Kansas |
Date: | Mon, 31 Oct 1994 22:21:28 GMT |
Nreferences: | 94-10-144 |
Gabriela O. de Vivo <gdevivo@conicit.ve> 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.
:
An overloaded function does *different* things to different types.
A polymorphic function does *the same* thing to different types.
An overloaded function must examine the type of x and decide what to do
based on that type. An overloaded function whose argument can be integer
or real, for example, must be implemented using two entirely different
operations.
A polymorphic function, on the other hand, partially ignores the type of x.
It does the same thing (list concatenation, for example) to arguments of
various types. The collection of types that a polymorphic function will
accept might be described in terms of classes, but this is language dependent.
--
--Bill Kinnersley
billk@cs.ukans.edu
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.