home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19880 < prev    next >
Encoding:
Text File  |  1993-01-25  |  1.0 KB  |  41 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!walter!qualcom.qualcomm.com!pbender.qualcomm.com!user
  3. From: pbender@qualcomm.com (Paul Bender)
  4. Subject: Address of Member Functions
  5. Message-ID: <pbender-250193124301@pbender.qualcomm.com>
  6. Followup-To: comp.lang.c++
  7. Sender: news@qualcomm.com
  8. Nntp-Posting-Host: pbender.qualcomm.com
  9. Organization: QUALCOMM, Incorporated
  10. Date: Mon, 25 Jan 1993 20:47:04 GMT
  11. Lines: 28
  12.  
  13. Is there a reason why this will not valid?
  14.  
  15. class X {
  16. private:
  17.   void g1(void);
  18.   void (*g)(void);
  19. public:
  20.   X(void);
  21.   void f(void);
  22. };
  23.  
  24. void X::f(void)
  25. {
  26.   g = &g1;                // line 12
  27. }
  28.  
  29. main(void)
  30. {
  31.   X x;
  32. }
  33.  
  34. When I compile it using g++, I get the following error message:
  35. test.C:14: assignment between incompatible pointer types
  36.  
  37. ------------------------------------------------------------------------------
  38. Paul E. Bender                 |  The opinions are my own and should not be
  39. pbender@qualcomm.com           |  unfavorably attributed to anyone else.
  40. ------------------------------------------------------------------------------
  41.