Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

How to make a variable that can contain 'flags'

$
0
0
Like the title says, I want to make a variable in my classes that I can pass bitwised flags to like I have seen in OpenGL. So I can do stuff like:

class Dude
{
  protected:
     ThisIsTheVariable flag;
// blah blah
}

Dude.flag = EATING | BREATHING | ALIVE;



... Or something like that.

I'm assuming I need to use a struct or something but I tried that and it didn't work so I'm wondering how anyone else has done/would do it. Thanks in advance.

Viewing all articles
Browse latest Browse all 51036

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>