Practice ยท 2 of 2
Rule of Three: a deep-copying Blob
Implement class Blob owning int* data_; std::size_t n_;: constructor Blob(std::size_t n) zero-initializes heap memory, destructor frees it, copy constructor deep-copies, and copy assignment deep-copies with a self-assignment guard. Provide std::size_t size() const and int& at(std::size_t). The test mutates a copy and checks the original is untouched (deep, not shallow).
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Rule of Three and move semantics