#include <iostream>
typedef unsigned int Bit;
class File {
Bit mode : 2;
Bit modified : 1;
Bit prot_owner : 3;
Bit prot_group : 3;
Bit prot_world : 3;
int a;
public:
void modifiy() { modified = 1; mode = 1; }
void read() { mode = 0;modified = 0;
}
void write() { modified = 0; mode = 2; }
void printMode() { std::cout << "mode is :" << mode << " modified is :" << modified << std::endl; }
};
int main()
{
File f;
f.read();f.printMode();
f.modifiy();f.printMode();
f.write();f.printMode();
std::cout << sizeof(f) << std::endl;
std::cout << sizeof(int) << std::endl;
}
mode is :0 modified is :0
mode is :1 modified is :1
mode is :2 modified is :0
8
4