Re: Defining polymorphism vs. overloading

hrubin@l.cc.purdue.edu (Herman Rubin)
3 Sep 90 12:55:57 GMT

          From comp.compilers

Related articles
Defining polymorphism vs. overloading oliver@karakorum.berkeley.edu (1990-08-30)
Re: Defining polymorphism vs. overloading burley@world.std.com (1990-09-01)
Re: Defining polymorphism vs. overloading wright@gefion.rice.edu (1990-09-02)
Re: Defining polymorphism vs. overloading compilers-sender@esegue.segue.boston.ma.us (1990-09-03)
Re: Defining polymorphism vs. overloading hrubin@l.cc.purdue.edu (1990-09-03)
Re: Defining polymorphism vs. overloading px@fctunl.rccn.pt (1990-09-03)
Re: Defining polymorphism vs. overloading plph@caen.engin.umich.edu (1990-09-03)
Re: Defining polymorphism vs. overloading daveg@near.cs.caltech.edu (1990-09-03)
Re: Defining polymorphism vs. overloading dmw9q@uvacs.cs.Virginia.EDU (1990-09-05)
Re: Defining polymorphism vs. overloading pase@orville.nas.nasa.gov (1990-09-06)
Re: Defining polymorphism vs. overloading tub!wg@relay.EU.net (1990-09-06)
[12 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: hrubin@l.cc.purdue.edu (Herman Rubin)
Keywords: polymorphism, design
Organization: Purdue University Statistics Department
References: <9008310419.AA06194@karakorum.berkeley.edu> <BURLEY.90Sep1013113@world.std.com>
Date: 3 Sep 90 12:55:57 GMT

In article <BURLEY.90Sep1013113@world.std.com>, burley@world.std.com (James C Burley) writes:
> In article <9008310419.AA06194@karakorum.berkeley.edu> oliver@karakorum.berkeley.edu (Oliver Sharp) writes:
>
> o Overloading means using the same name (or symbol) to invoke different
> code depending on the types of the arguments (or operands)....
>
> o Polymorphism means using the same piece of code to operate on objects
> of different types.
..................


> Conceptually, what is the difference? Let's look at our favorite overloaded
> operator, addition:
>
> y + z
>
> Now if y and z can be of several valid types, we say that + is overloaded
> because we know it must perform different actions depending on the types.


Thus if y and z are long integers, this becomes (different assembler languages
have somewhat different notation, and this may not correspond to any)


ADDL y,z


and if they are floating


ADDF y,z


Now ADDL and ADDF will operate on either, so those are polymorphic and
not overloaded.
--
Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907
Phone: (317)494-6054
hrubin@l.cc.purdue.edu (Internet, bitnet) {purdue,pur-ee}!l.cc!cik(UUCP)
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.