I'm making a simple class that holds a 1 byte variable to use for 8 bit flags. But I don't know if I'm having a BIG LOOOONG brain fart or what, but i'm having problems lol.
class Flag
{
BYTE flags;
public:
/*** This works fine for checking if a bit is on or off, but what could I do about turning a bit on or off via the '[]' operator? ***/
bool operator[](int i)
{
// shift over to the bit we are checking for and check if it's on
if((flags >> i) & 1)
return true;
// The bit is turned off
return false;
}
};







