Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think.com!mintaka!bloom-beacon!eru!hagbard!sunic!ericom!falcon.ericsson.se!jonas From: jonas@falcon.ericsson.se (Jonas Nygren) Newsgroups: comp.lang.c++ Subject: Re: asking an object for its type Message-ID: <1991Feb21.095308.5371@ericsson.se> Date: 21 Feb 91 09:53:08 GMT References: <23984@netcom.COM> <1190@sheol.UUCP> <1991Feb19.000449.22255@gpu.utcs.utoronto.ca> Sender: news@ericsson.se Organization: Ericsson Telecom, Stockholm, Sweden Lines: 17 In article <1991Feb19.000449.22255@gpu.utcs.utoronto.ca> craig@gpu.utcs.utoronto.ca (Craig Hubley) writes: >In article <1190@sheol.UUCP> throopw@sheol.UUCP (Wayne Throop) writes: >>> aed@netcom.COM (Andrew Davidson) >>> I have some processing that only applies for certain types of objects. >>> If an object is not of the correct type I want to do some error stuff. >>> The problem is how do I fiqure out what the type of the object is. Simula have dynamic typechecking and also an operator 'in' which could be used to achieve exactly what you want. In the C++ world I believe that the NIH library do type all objects and this mechanism would probably also solve your problem. The mechanism in NIH is a bit akward to use (my personal opinion) but you do not have to invent your own scheme. (I do not know were you can find NIH). /Jonas