CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// from codes by Sharpneli and Jerry Hobby
#include <cstdio>
using namespace std;
class User{
int level_ = 0b00000000;
const char* username_;
public:
enum Privilege {
IS_AUTH = 0b00000001,
IS_MOD = 0b00000010,
IS_ADMIN = 0b00000100
};
User(const char* uname, int privilege) : username_(uname) {
level_ |= privilege;
}
inline bool isAuth() const{
return level_ & IS_AUTH;
}
inline bool isMod() const{
return level_ & IS_MOD;
}
inline bool isAdmin() const{
return level_ & IS_ADMIN;
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run