home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!stanford.edu!rutgers!cmcl2!HAPPY.CS.NYU.EDU!m-ag7953
- From: m-ag7953@HAPPY.CS.NYU.EDU (Andrew Gideon)
- Newsgroups: comp.lang.c++
- Subject: nested enum problem
- Keywords: nested enum anachronism scope
- Message-ID: <9209021504.AA07297@happy.cs.nyu.edu>
- Date: 2 Sep 92 15:04:57 GMT
- Sender: daemon@cmcl2.nyu.edu (Mr Background)
- Organization: New York University
- Lines: 63
-
-
-
- I believe that I have seen this problem some time back on this
- group, but I'm not certain, and I don't recall the answer anyway.
-
- I have a class with an enclosed enumeration. To force proper
- scoping of the enumeration (I use the same enumeration name
- elsewhere), I also have a "dummy" global enumeration of the
- same name.
-
- The class which contains the enumeration has a non-inline
- function that returns a value of the enumeration type. When
- compiling this line, I get the error:
-
- warning: nested DBResultCodes as return type for non-inline member function, use DBQuery::DBResultCodes DBQuery::nextResults(){} in definition (ana
- chronism)
-
- The problem is that I have already done so! The declaration of
- that member function is:
-
-
- DBQuery::DBResultCodes nextResults();
-
-
- So why am I getting this warning? How can I shut it up?
-
- At the end of this message is a small (but complete) example that
- recreates this warning.
-
- I am using Sun's 2.1 C++ Compiler. I would appreciate any and all
- responses. Please reply by email, and I'll post the solutions
- (if any {8^( ).
-
- Thanks very much...
-
- Andrew Gideon
- m-ag7953@happy.cs.nyu.edu
-
-
-
- ------------------------------ Example Follows ------------------------------
-
- #include <iostream.h>
-
- enum Values {Fake};
-
- class Domain1
- {
- public:
- enum Values {One = 1, Two = 2};
- Domain1::Values f();
- };
-
- class Domain2
- {
- public:
- enum Values {Two = 1, One = 2};
- Domain2::Values g();
- };
-
- main()
- {
- }
-