home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / gnu / g / help / 1476 < prev    next >
Encoding:
Text File  |  1992-11-23  |  1.0 KB  |  47 lines

  1. Path: sparky!uunet!spool.mu.edu!agate!agate.Berkeley.EDU!sethg
  2. From: sethg@roar.CS.Berkeley.EDU (Seth C. Goldstein)
  3. Newsgroups: gnu.g++.help
  4. Subject: what is a "contravarience violation for method types"
  5. Date: 23 Nov 92 11:32:33
  6. Organization: /home/auspex/b/threadid/sethg/.organization
  7. Lines: 35
  8. Distribution: world
  9. Message-ID: <SETHG.92Nov23113233@roar.CS.Berkeley.EDU>
  10. NNTP-Posting-Host: roar.cs.berkeley.edu
  11.  
  12. When compiling the following with g++-2.3.1 I get warnings of the form:
  13.  
  14. quad.C: In method `Toplevel::Toplevel ()':
  15. quad.C:27: warning: contravariance violation for method types ignored
  16.  
  17. What does it mean?
  18.  
  19. example:
  20. ////////////////////////////////////////////////////////////////////////
  21. class Frame;
  22. typedef void (Frame::*Codeblock)(void);
  23.  
  24. class Frame
  25. {
  26. protected:
  27.     int         counter;
  28.  
  29. public:
  30.     inline      Frame(Codeblock function);
  31. };
  32.  
  33. class Toplevel : Frame
  34. {
  35.     int         i;
  36. public:
  37.                 Toplevel(void);
  38.     void        runtop(void);
  39. };
  40.  
  41. Toplevel::Toplevel(void) : Frame(&(Toplevel::runtop))    // line 27
  42. {
  43.  
  44. }
  45.  
  46. -seth
  47.