home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / gnu / g / help / 1214 < prev    next >
Encoding:
Text File  |  1992-09-10  |  977 b   |  43 lines

  1. Newsgroups: gnu.g++.help
  2. Path: sparky!uunet!van-bc!ubc-cs!unixg.ubc.ca!kakwa.ucs.ualberta.ca!acs.ucalgary.ca!news
  3. From: edstrom@Elmer.hsc.ucalgary.ca (John Edstrom)
  4. Subject: how to do this?
  5. Message-ID: <92Sep10.203359.4881@acs.ucalgary.ca>
  6. Sender: news@acs.ucalgary.ca (USENET News System)
  7. Date: Thu, 10 Sep 92 20:33:59 GMT
  8. Distribution: gnu
  9. Nntp-Posting-Host: elmer.hsc.ucalgary.ca
  10. Organization: Neuroscience Division, U of Calgary School of Medicine, Calgary, Alberta, Canada
  11. Lines: 30
  12.  
  13.  
  14.  
  15. I am trying to convert some C++ code to g++.  What is wrong with the
  16. following constructions and how can I do it in g++?
  17.  
  18. ----------
  19.  
  20. class a {
  21. public: 
  22.     int x();
  23. };
  24.  
  25. int a::x() { return 1; }
  26.  
  27. main() {
  28.     printf("%x\n", (int(*))a::x);
  29. }
  30.  
  31.  
  32. the compiler complains that it cannot convert a::x to a pointer
  33.  
  34.  
  35. what am I doing wrong?
  36.  
  37. JE
  38. --
  39.  RM 2104, HSc Building,  Div. Neuroscience
  40.  U. Calgary School of Medicine,  3330 Hospital Drive NW
  41.  Calgary, Alberta       T2N 3Y4
  42.  (403) 220 4493  (wk)
  43.