103. Destructors-I

Question.6

A class allocates a buffer in the constructor but has no destructor:

class DataLogger {
   uint8_t* buf;
public:
   DataLogger(int size) : buf(new uint8_t[size]) {}
   // No destructor!
};

void log_data() {
   DataLogger dl(256);
} // dl goes out of scope

What happens when dl is destroyed?

Need Help? Refer to the Quick Guide below

Select Answer