From Jerry Coffin · 1996-04-04 03:21 · #73555 in EMULATE
On (02 Apr 96) Mike Bilow wrote to Walt Karas...
MB> Walt Karas wrote in a message to DAVID NUGENT:
WK> Polymorphism is not possible in C++ without casting,
MB> That's news to me.
Not if you think about it: you have to use pointers or references to the
base object holding the address of a derived object. Putting that
address there requires casting (generally implicit) of the pointer to
derived to pointer to base. (I'm not at all sure this is what the
original post meant to refer to though.)
WK> Explicit casting is often necessary, and sometimes desirable
WK> for improved code readability.
MB> Casting is inherently dangerous. This is why C++ has facilities for
MB> type-safe polymorphism, such as is implemented in the iostream
MB> library. In fact, C++ has facilities for type-safe casting with high
MB> efficiency, such as templates, which do not exist in any other object
MB> oriented language, such as Smalltalk.
It doesn't exist in Smalltalk, that's true. It does exist in some other
OO languages such as Ada 95 - in fact most of the concept and syntax for
C++'s templates came from Ada, including the use of <> as type argument
delimiters. (Note that Ada 83 was more object based than object
oriented, but Ada 95 includes full object orientation.)
Later,
Jerry.
... The Universe is a figment of its own imagination.
--- PPoint 1.90
* Origin: Point Pointedly Pointless (1:128/77.3)