Article View: comp.std.c++
Article #58Re: run-time type checking (was: Re: Covariant Types in Derived Classes)
From: Chip Salzenberg
Date: Mon, 03 Aug 1992 20:33
Date: Mon, 03 Aug 1992 20:33
14 lines
1056 bytes
1056 bytes
According to shang@corp.mot.com:
> void foo (Animal *a, Reptile *r)
> {
> if (a#==r#) a->mate(*r); // okay (I use a# to express typeof(*a))
> }
This won't fly. Dog and Wolf may be distinct classes, yet they can
mate. If RTTI is to work in this case, it would have to be a
conditional cast (or an "iskindof" test, which amounts to the same
thing).
--
Chip Salzenberg at Teltronics/TCT <chip@tct.com>, <73717.366@compuserve.com>
"Do Rush place weird subliminal backmasked messages in their songs to
compel unwilling geeks to commit evil .sig atrocities?" -- Dean Engelhardt
Technical Details
Message-ID:
<2A7D97FF.7C38@tct.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!sybus.sybus.com!myrddin!tct!chipReferences:
<1992Jul30.171127.18238@ucc.su.OZ.AU> <1992Jul31.234928.1313@cadsun.corp.mot.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c++,comp.lang.c++ Path: arc1-ca.pugleaf.net!sparky!uunet!sybus.sybus.com!myrddin!tct!chip From: chip@tct.com (Chip Salzenberg) Subject: Re: run-time type checking (was: Re: Covariant Types in Derived Classes) Message-ID: <2A7D97FF.7C38@tct.com> Date: Mon, 3 Aug 1992 20:33:03 GMT References: <1992Jul30.171127.18238@ucc.su.OZ.AU> <1992Jul31.234928.1313@cadsun.corp.mot.com> Organization: TC Telemanagement, Clearwater, FL Lines: 14