blob: 2c6c1942077bf25dd5a95fbc6fab1d26fd6c50c9 (
plain)
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
29
30
31
32
33
34
35
36
37
38
39
|
#include <iostream>
/*
*
* 7.53
*
*
*/
class Debug {
public:
constexpr Debug(): hardware(false), inputoutput(false), other(false) {}
constexpr Debug(bool a, bool b, bool c): hardware(a), inputoutput(b), other(c) {}
constexpr void SetHW(bool a) { hardware = a; }
constexpr void SetIO(bool a) { inputoutput = a; }
constexpr void SetO(bool a) { other = a; }
constexpr bool GetHW() const { return hardware; }
constexpr bool GetIO() const { return inputoutput; }
constexpr bool GetO() const { return other; }
private:
bool hardware;
bool inputoutput;
bool other;
};
int main () {
Debug D1;
Debug Derrors(true, true, true);
std::cout << D1.GetHW() << " " << D1.GetIO() << " " << D1.GetO() << std::endl;
D1.SetHW(true);
std::cout << D1.GetHW() << " " << D1.GetIO() << " " << D1.GetO() << std::endl;
std::cout << Derrors.GetHW() << " " << Derrors.GetIO() << " " << Derrors.GetO() << std::endl;
D1 = Derrors;
std::cout << D1.GetHW() << " " << D1.GetIO() << " " << D1.GetO() << std::endl;
constexpr Debug D2(true, false, true);
std::cout << D2.GetHW() << " " << D2.GetIO() << " " << D2.GetO() << std::endl;
return 0;
}
|