TIP: Click on subject to list as thread! ANSI
echo: c_echo
to: Neil Heller
from: Bill Birrell
date: 2004-07-11 05:41:00
subject: Polymorphism ?

> NH> Can the term "polymorphism" be applied equally (and
 > NH> correctly) to variables, operators and function names?

 > PS> Yes, though operators and functions are not really
 > PS> different things, and having a polymorphic variable is not
 > PS> possible in any programming language that I know of. ;)

 > If I were to instantiate a pointer to an object of
 > Class A (call it
 > opa), coercing that pointer into a type of Class B
 > could do the
 > following:

 > #1  opa->foo();

 > #2  opb(opa)->foo();

 > Line #1 would do class A's foo() and line #2 would do, > class B's foo().
 > Is that not the action of a polymorphic variable?

    You are still confusing form (or shape) with type, Neil.

    Let's throw the Greek away and concentrate on what we do understand.
Polymorphic=multiform, monomorphic = uniform. There are two other terms
with relevance, isomorphism and homeomorphism. A google search will find
the mathematical definitions of all four terms. It will also show where
metamorphosis can occur. (e.g. similar triangles are homeomorphic, but
congruent triangles are also isomorphic).

    unions appear to be intrinsically polymorphic variables, but they
merely have multiple types. They do not have multiple shapes. There are no
truly polymorphic variables, simply because variables have to be
identified, declared and defined. This imposes uniformity (monomorphism) on
them. Type and shape are different categories altogether.

    Let me illustrate: You and your dog are the same type of animal - you
are mammals. However your form is human while your dog's form is canine.
Does this clarify, or only confuse?

Best Wishes,
Bill.

---
* Origin: Escan BBS (2:25/200)
SEEN-BY: 633/267 270
@PATH: 25/200 108 252/110 250/501 140/1 106/2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.