From 3edb35c6cab27d36f0fde49726db8cc9289e7304 Mon Sep 17 00:00:00 2001 From: Oskar Date: Wed, 2 Oct 2024 11:23:38 +0200 Subject: more --- 7p53.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 7p53.cpp (limited to '7p53.cpp') diff --git a/7p53.cpp b/7p53.cpp new file mode 100644 index 0000000..2c6c194 --- /dev/null +++ b/7p53.cpp @@ -0,0 +1,39 @@ +#include + +/* + * + * 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; +} -- cgit v1.2.3