home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / cplus / 11482 < prev    next >
Encoding:
Text File  |  1992-07-24  |  1.4 KB  |  40 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!boulder!thicks
  3. From: thicks@fred.Colorado.EDU (Tom Hicks)
  4. Subject: derived class destructors
  5. Message-ID: <1992Jul24.162930.9111@colorado.edu>
  6. Originator: thicks@fred
  7. Keywords: destructors, derived class 
  8. Sender: news@colorado.edu (The Daily Planet)
  9. Nntp-Posting-Host: fred.colorado.edu
  10. Organization: University of Colorado Boulder, OCS
  11. Distribution: usa
  12. Date: Fri, 24 Jul 1992 16:29:30 GMT
  13. Lines: 25
  14.  
  15. Hi -
  16.  
  17. I am having a problem with a destructors, and I can't find any
  18. examples of how to use destructors with derived classes.  I have three classes,
  19. X, Y and Z, such that:
  20.  
  21.     class Z: public X, public Y { // etc. };
  22.  
  23. I have destructors for classes X and Y, and when I call the destructor for
  24. Z, I want to also call the X and Y destructors.  I am trying to use
  25.  
  26.     Z::~Z() : ~X() , ~Y() { // etc. }
  27.  
  28. but the compiler keeps giving me a syntax error.  I know that this is the
  29. correct syntax for constructors, but is this the proper syntax for destructors?
  30. I have searched Stroustrup's "The C++ Programming Language", but could not
  31. find any useful help on this subject.
  32.  
  33. Please e-mail responses.  Any help/pointers appreciated.
  34.  
  35. -------------------------------------------------------------------------
  36.     Tom Hicks
  37.     thicks@fred.colorado.edu           Optoelectronic Computing 
  38.     (303) 492 - 2769                    Systems Center, CU-CSU
  39. --------------------------------------------------------------------------
  40.