Example:
enum Flags
{
A,
B,
C,
D
};
class MyClass
{
std::string data;
int foo;
// Flags theFlags; (???)
}
- How can I achieve that it is possible to set any number of the "flags" A,B,C and D in the enum above in an instance of MyClass?
My goal would be something like this:
if ( MyClassInst.IsFlagSet( A ) ) // ...
MyClassInst.SetFlag( A ); //...
- Do I have to use some array or vector? If yes, how?
- Are enums a good idea in this case?