home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / cplus / 13200 < prev    next >
Encoding:
Text File  |  1992-09-02  |  1.8 KB  |  75 lines

  1. Path: sparky!uunet!stanford.edu!rutgers!cmcl2!HAPPY.CS.NYU.EDU!m-ag7953
  2. From: m-ag7953@HAPPY.CS.NYU.EDU (Andrew Gideon)
  3. Newsgroups: comp.lang.c++
  4. Subject: nested enum problem
  5. Keywords: nested enum anachronism scope
  6. Message-ID: <9209021504.AA07297@happy.cs.nyu.edu>
  7. Date: 2 Sep 92 15:04:57 GMT
  8. Sender: daemon@cmcl2.nyu.edu (Mr Background)
  9. Organization: New York University
  10. Lines: 63
  11.  
  12.  
  13.  
  14. I believe that I have seen this problem some time back on this
  15. group, but I'm not certain, and I don't recall the answer anyway.
  16.  
  17. I have a class with an enclosed enumeration.  To force proper
  18. scoping of the enumeration (I use the same enumeration name
  19. elsewhere), I also have a "dummy" global enumeration of the 
  20. same name.
  21.  
  22. The class which contains the enumeration has a non-inline
  23. function that returns a value of the enumeration type.  When
  24. compiling this line, I get the error:
  25.  
  26.     warning: nested DBResultCodes  as return type for non-inline member function, use  DBQuery::DBResultCodes   DBQuery::nextResults(){} in definition (ana
  27. chronism)
  28.  
  29. The problem is that I have already done so!  The declaration of
  30. that member function is:
  31.  
  32.  
  33.   DBQuery::DBResultCodes nextResults();
  34.  
  35.  
  36. So why am I getting this warning?  How can I shut it up?
  37.  
  38. At the end of this message is a small (but complete) example that
  39. recreates this warning.
  40.  
  41. I am using Sun's 2.1 C++ Compiler.  I would appreciate any and all
  42. responses.  Please reply by email, and I'll post the solutions
  43. (if any {8^(  ).
  44.  
  45. Thanks very much...
  46.  
  47.     Andrew Gideon
  48.     m-ag7953@happy.cs.nyu.edu
  49.  
  50.  
  51.  
  52. ------------------------------ Example Follows ------------------------------
  53.  
  54. #include  <iostream.h>
  55.  
  56. enum  Values {Fake};
  57.  
  58. class Domain1
  59.   {
  60.   public:
  61.     enum Values {One = 1, Two = 2};
  62.     Domain1::Values f();
  63.   };
  64.  
  65. class Domain2
  66.   {
  67.   public:
  68.     enum Values {Two = 1, One = 2};
  69.     Domain2::Values g();
  70.   };
  71.  
  72. main()
  73.   {
  74.   }
  75.