home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zephyr.ens.tek.com!shaman!pogo!jonh.wv.tek.com!user
- From: jonh@pogo.wv.tek.com (Jon Howell)
- Newsgroups: comp.sys.mac.programmer
- Subject: Think C Debugger & Class dynamic typing
- Message-ID: <jonh-130892150657@jonh.wv.tek.com>
- Date: 13 Aug 92 22:07:51 GMT
- Sender: nobody@pogo.wv.tek.com
- Followup-To: comp.sys.mac.programmer
- Organization: Tektronix
- Lines: 44
-
- [I haven't really researched either of these problems in depth -- RTFM
- replies are welcome. :v]
-
- In the process of debugging my project, a thought finally occurred to me.
- (It's amazing I've gotten this far without a thought, but...) When you look
- at a CObject in the Data window of the debugger, and dereference it to open
- up a view of the object's structure, it views the object as though it were
- the type it's declared as in the context. Why can't/doesn't it use the type
- the object *really* is? For example:
-
- {
- CView *hokey;
-
- hokey = new CWindow;
- hokey ->IWindow(blah blah blah);
- <> hokey ->Update();
- }
-
- (The <> is a breakpoint.) If I stop there and view *hokey (and double-click
- the address to see the contents of the struct), I only see as much
- information
- as pertains to a CView. However, hokey is *really* a CWindow, and the
- debugger
- should be able to figure that out dynamically, right? Symantec? :v)
-
- Another question: TC provides member() and class_name() (and another I
- forget)
- functions for figuring out the dynamic type of an object. I'd like to be
- able
- to see if an object I've been passed is of a certain type. However, I don't
- want to do a string compare (class_name), and member() seems to only tell
- me
- if the object is a member of class X or one of its ancestors. [Well, yes,
- in fact, it IS a CObject! :v] Is there a way I can get an integer which
- uniquely identifies the class? (It'd be extra cool if it gave some info on
- the
- hierarchy, but... :v)
-
- Thanks,
-
- --Jon
-
- -----------------------------------------------------------------------------
- jonh@pogo.wv.tek.com Jon Howell
-