|
-
February 3rd, 2005, 10:25 PM
#1
increment operator problem
The following code does not compile, why?
1 int main ()
2 {
3 enum Day { Sun, Mon, Tue };
4
5 Day& operator++ (Day& d)
6 {
7 d = (Day) (d + 1);
8 return d;
9 }
10 }
Line 5 generates a compiler error similar to the following...
Unrecognized type name "Day"
This was compiled on a Sun box running Solaris 8 with their C++ compiler version 5.3.
Is there some fundamental problem with this code, or is this possibly a bug in the compiler?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|