home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c++:11548 comp.std.c++:959
- Newsgroups: comp.lang.c++,comp.std.c++
- Path: sparky!uunet!cs.utexas.edu!torn!watserv1!watmath!watcgl!rhbartel
- From: rhbartel@watcgl.waterloo.edu (Richard Bartels)
- Subject: Re: run-time type checking (was: Re: Covariant Types in Derived Classes)
- Message-ID: <BryL9q.K5I@watcgl.waterloo.edu>
- Organization: Computer Graphics Laboratory, University of Waterloo, Ontario, Canada
- References: <1992Jul24.143359.3602@advtech.uswest.com> <1992Jul24.234628.21196@cadsun.corp.mot.com> <1992Jul25.172045.24675@ucc.su.OZ.AU>
- Date: Sat, 25 Jul 1992 19:10:38 GMT
- Lines: 21
-
- As long as the downcasting discussion is open again,
- the example we are confronting which requires something like
- that, we think, is the issue of input from disk.
-
- I would love to have a solution that did not require the cop-out of
- isA() and cast/convert.
-
- Consider the classic "List" class and "ListNode" class.
- ListNode is a base class, and assume there are two flavors
- of derived node. We write a List that contains a mix of
- these nodes out to a file; now we want to read the List back
- in and reconstruct it.
-
- Can it be done without resorting to an isA() member function,
- some member data to identify node type, and possibly some
- casting/conversion?
-
- What's the authoritative answer?
-
- -Richard
-
-