Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!rutgers!mcnc!rti!xyzzy!yoyodyne!duvarney From: duvarney@yoyodyne.rtp.dg.com (Dan DuVarney) Newsgroups: comp.lang.c++ Subject: Re: Is there a way to tell which derived class an object belongs to? Message-ID: <2930@xyzzy.UUCP> Date: 5 Feb 90 04:41:33 GMT References: <138@farcomp.UUCP> <2815@draken.nada.kth.se> Sender: usenet@xyzzy.UUCP Reply-To: duvarney@yoyodyne.rtp.dg.com (Dan DuVarney) Organization: Data General Corporation, Research Triangle Park, NC Lines: 12 If you are interested in telling which derived class an object belongs to, then you should check out Keith Gorlen's OOPS library. OOPS defines a class "Class" which contains the name, inheritance, etc. for a given class. For each OOPS class, there is a corresponding member of Class, usually called "class_." There is a virtual function "isA()" for each object that returns a reference to the appropriate Class variable. This scheme is more complicated than type-id numbers, but has the advantage that you can ask questions like "is this object a member of a class derived from the class 'Set?'" Dan DuVarney ...!mcnc!rti!dg-rtp!duvarney