Code Room
Code reviewHard
Question
Review this C++ RAII buffer wrapper.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
class Buffer {public: explicit Buffer(size_t n) : data_(new char[n]), size_(n) {} ~Buffer() { delete[] data_; } char* get() { return data_; }private: char* data_; size_t size_;}; void consume(Buffer b); // takes by value void run() { Buffer buf(4096); consume(buf); // pass a copy buf.get()[0] = 'x';}Run or narrate your approach, then ask the coach.