Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!oitnews.harvard.edu!news.sesqui.net!news.ti.com!ticipa!clw
From: clw@ticipa.works.ti.com (Chris Winemiller)
Subject: Re: What is Polymorphism means?
Message-ID: <1996Mar11.183319.2553@ticipa.works.ti.com>
Organization: None
References: <4hfh5q$oot@macondo.dmu.ac.uk> <NEWTNews.19575.826001386.hampton@ip163.herndon7.va.interramp.com>
Date: Mon, 11 Mar 1996 18:33:19 GMT
Lines: 36

In article <NEWTNews.19575.826001386.hampton@ip163.herndon7.va.interramp.com> us011245@interramp.com writes:
>
>In article <4hfh5q$oot@macondo.dmu.ac.uk>, <se1rh@dmu.ac.uk> writes:
>
>> In article <4hcd84$ouq@watnews2.watson.ibm.com>, David N. Smith
>> <dnsmith@watson.ibm.com> writes:
>> > In article <960303.011432.29157@banshee.uunet.ca> , masoud@travel-net.com
>> > writes:
>> > >I was looking at chapter 6 under c:\vwin \ tutorial  and I saw this
>> > >word "Polymorphism"
>> > 
>> > Polymorphism means multiple meanings. In Smalltalk, polymorphism means
>> > that there are multiple methods with the same name and that any one of
>> > them might be invoked by a single message send.
>
>Whoa guys! I think we're making this way too hard.  Polymorphism essentially 
>(Disclaimer to avoid flames from theoreticians) means that subclasses can 
>reinterpret an operation defined in a super class in different ways.

You've narrowed the scope too much. David Smith has it right. For a
living, breathing example of polymorphism in your Smalltalk image, check
out Transcript. It understands some of the Stream protocol: #cr,
#nextPut, #nextPutAll:, #tab, #space for example. So you can write code
and hand it a Transcript instead of a Stream kind of object for writing
out something, and both the Transcript and Stream kind of object will
behave appropriately. Transcript (a TextCollector in VW) and Stream
don't have any common inheritance (except Object), yet share a common
protocol, making them polymorphic with having a superclass/subclass
relationship.

Regards,
Chris
==============================================================
Chris Winemiller               Internet: clw@works.ti.com
Disclaimer: I do not speak for TI.
==============================================================
