can you have an accessor function that returns an enum type?
Yes, as long the enum is named.
Last edited on
enum myColor {red, green, blue};
class shape
{
public:
shape();
myColor get_color();
private:
myColor color;
};
like this?
there is an error as thus:
1>shape.h(11) : error C2011: 'myColor' : 'enum' type redefinition
1>shape.h(11) : see declaration of 'myColor'
explain if you will
Last edited on
Apparently, you already defined 'myColor' somewhere else as something else. If that's not the case, I'll need to see which one is line 11.
this is the header file for my shape object and line 11 is the line i define enum myColor?
Last edited on
enum shapeColor {red, green, blue};
gives me the same error?
and i have not defined any macro with the same name?
Are you using inclusion guards?
do you mean #ifdefined
or is there a certain lib i am missing?