home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- From: nikki@trmphrst.demon.co.uk (Nikki Locke)
- Path: sparky!uunet!pipex!demon!trmphrst.demon.co.uk!nikki
- Distribution: world
- Subject: Re: run-time type checking)
- References: <TMB.92Jul29125322@arolla.idiap.ch>
- X-Mailer: cppnews $Revision: 1.10 $
- Organization: Trumphurst Ltd.
- Lines: 24
- Date: Fri, 31 Jul 1992 11:33:16 +0000
- Message-ID: <712607596snx@trmphrst.demon.co.uk>
- Sender: usenet@gate.demon.co.uk
-
-
- In article <TMB.92Jul29125322@arolla.idiap.ch> tmb@idiap.ch writes:
- > It would, in fact, be nice if C++ had a tagged union type, like Pascal
- > or SML. Something along the lines of:
- >
- > union hetero int {
- > case 1: type1 *p1;
- > case 2: type2 *p2;
- > };
- >
- > int f(hetero h) {
- > switch(h) {
- > case 1: return h.p1->foo();
- > case 2: return h.p2->bar();
- > }
- > }
- **** YEEEUUUURRRGGGGHHHH *****
- Surely this is what virtual functions are for.
- ---
- Nikki Locke | | nikki@trmphrst.demon.co.uk
- Trumphurst Ltd. | Tel: +44 (0)691-670318 | nikki@cix.compulink.co.uk
- PC and Unix consultancy | Fax: +44 (0)691-670316 | nikki@kewill.co.uk
- trmphrst.demon.co.uk is NOT connected with ANY other sites at demon.co.uk.
- Demon.co.uk is a dial-up subscription access point to the Internet.
-