Question: C++ 9.3.3: Deallocatingmemory Deallocate memory for kitchenPaint using the deleteoperator. class PaintContainer { public: ~PaintContainer(); double gallonPaint; }; PaintContainer::~PaintContainer() { // Covered in section onDestructors.

C++ 9.3.3: Deallocatingmemory

Deallocate memory for kitchenPaint using the deleteoperator.

class PaintContainer {
public:
~PaintContainer();
double gallonPaint;
};

PaintContainer::~PaintContainer() { // Covered in section onDestructors.
cout << "PaintContainer deallocated." < return;
}

int main() {
PaintContainer* kitchenPaint;

kitchenPaint = new PaintContainer;
kitchenPaint->gallonPaint = 26.3;

/* Your solution goes here */

return 0;
}

Step by Step Solution

3.37 Rating (156 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

C program to update the provided code by adding statement to delete the pointer ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!