#include enum COLORS { BLACK, RED, BLUE, GREEN }; enum MONTH { JAN=1, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC }; enum READY { READY_NO, READY_YES }; // bitfields can have any integral or enumeration types ... i.e. not floating point // class or struct can be used with bitfields struct Foo { unsigned int color:2; unsigned int month:4; unsigned int ready:1; }; int main(int argc, char** argv) { Foo f; f.color = GREEN; f.month = FEB; f.ready = READY_YES; std::cout << "Color: " << f.color << std::endl; std::cout << "Month: " << f.month << std::endl; std::cout << "Ready: " << (f.ready ? "READY" : "NOT READY") << std::endl; // 4 bytes on my machine where unsigned int is also 4 bytes std::cout << "SIZE: " << sizeof(f) << std::endl; return 0; }