In C++, A class can define a (nonstatic) data member as a bit-field. We indicate that a member is a bit-field by following the member name with a colon and a constant expression specifying the number of bits.
* A bit-field shall not be a static member.
* Ordinarily it is best to make a bit-field an unsigned type. The behavior of bit-fields stored in a signed type is implementation defined.
* The address-of operator & shall not be applied to a bit-field, so there are no pointers to bit-fields.
```
#include <iostream>
using namespace std;
class File {
public:
unsigned int mode:2;
};
int main()
{
enum modes { READ = 01, WRITE = 02, EXECUTE = 03 };
File file;
cout << file.mode << ",";
file.mode |= READ;
cout << file.mode << ",";
file.mode |= WRITE;
cout << file.mode << endl;
return 0;
}
// output 0, 1, 3
```