I am writing a program that will instantiae with 2 colors for a flag, and accept two colors from the user to change them. On my second switch I get a "error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'enum color' (or there is no acceptable conversion)" message..I have talked with another student (who is much better than I) and we are both confused by this. I only get the error for the second switch statement(it lists all 5 of them)...
no, it didn't, haha, I am so far back, l have had my comp for 3 of 17 weeks of class, my instructor maintains that since we have gone over this, he won't help...
I did change cColorTwo to cColor like the first switch, and it compiles and runs but stops after the second color choice is made...error:
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
The thread 0xBE8 has exited with code 4726424 (0x481E98).
The program 'F:\FlagAgain\Flag\Debug\Flag.exe' has exited with code 4726424 (0x481E98).
There is some confusion with your variable names : cColor,cColorOne and cColorTwo.
The compiler did not complain about cColor in setch statement 1 - so you have a member variable my this name.
In switch statement 2 - the cColorTwo visible at that time is the POINTER cColorTwo you setup in line5.
Further down in line 82 you assign a value to a variable called cColorTwo - so obviously you have a member variable by that name.
So... The two pointers in Line 4 and 5 are the problems because cColorTwo pointer is creating a name clash, you don't do anything with the cColorOne pointer AND as soon as the constructor finishes their value will be lost as they are local variable - and but the new colors created will still be there so that is a memory leak as well.
ahhh yes I noticed that discrepency, when I changed the 1st switch statement variable to cColorOne, I get the same error as on the 2nd switch statement.
Here, maybe the entire code will help: