100. Constructors-II

Question.1

A class manages a dynamically allocated buffer:

class Buffer {
   uint8_t* data;
   int size;
public:
   Buffer(int s) : size(s), data(new uint8_t[s]) {}
   // No copy constructor defined
};

Buffer a(64);
Buffer b = a;  // Default shallow copy

What happens when both a and b are destroyed?

Need Help? Refer to the Quick Guide below

Select Answer