home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / sys / mac / programm / 13963 < prev    next >
Encoding:
Internet Message Format  |  1992-08-13  |  1.9 KB

  1. Path: sparky!uunet!zephyr.ens.tek.com!shaman!pogo!jonh.wv.tek.com!user
  2. From: jonh@pogo.wv.tek.com (Jon Howell)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Think C Debugger & Class dynamic typing
  5. Message-ID: <jonh-130892150657@jonh.wv.tek.com>
  6. Date: 13 Aug 92 22:07:51 GMT
  7. Sender: nobody@pogo.wv.tek.com
  8. Followup-To: comp.sys.mac.programmer
  9. Organization: Tektronix
  10. Lines: 44
  11.  
  12. [I haven't really researched either of these problems in depth -- RTFM
  13.  replies are welcome. :v]
  14.  
  15. In the process of debugging my project, a thought finally occurred to me.
  16. (It's amazing I've gotten this far without a thought, but...) When you look
  17. at a CObject in the Data window of the debugger, and dereference it to open
  18. up a view of the object's structure, it views the object as though it were
  19. the type it's declared as in the context. Why can't/doesn't it use the type
  20. the object *really* is?  For example:
  21.  
  22. {
  23.    CView *hokey;
  24.  
  25.    hokey = new CWindow;
  26.    hokey ->IWindow(blah blah blah);
  27. <> hokey ->Update();
  28. }
  29.  
  30. (The <> is a breakpoint.) If I stop there and view *hokey (and double-click
  31. the address to see the contents of the struct), I only see as much
  32. information
  33. as pertains to a CView. However, hokey is *really* a CWindow, and the
  34. debugger
  35. should be able to figure that out dynamically, right? Symantec? :v)
  36.  
  37. Another question: TC provides member() and class_name() (and another I
  38. forget)
  39. functions for figuring out the dynamic type of an object. I'd like to be
  40. able
  41. to see if an object I've been passed is of a certain type. However, I don't
  42. want to do a string compare (class_name), and member() seems to only tell
  43. me
  44. if the object is a member of class X or one of its ancestors. [Well, yes,
  45. in fact, it IS a CObject! :v] Is there a way I can get an integer which
  46. uniquely identifies the class? (It'd be extra cool if it gave some info on
  47. the
  48. hierarchy, but... :v)
  49.  
  50. Thanks,
  51.  
  52.          --Jon
  53.  
  54. -----------------------------------------------------------------------------
  55. jonh@pogo.wv.tek.com     Jon Howell
  56.