RAII Resource Guard
Implement a C++ RAII guard class that acquires a resource in constructor and releases it in destructor.
Constraints
- Use constructor/destructor.
- Resource simulated via bool flag.
- No manual release function.
- Prevent copying.
1class Guard {2private:3 bool *res;4public:5 Guard(bool *r);6 ~Guard();7};