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
C program to update the provided code by adding statement to delete the pointer ... View full answer
Get step-by-step solutions from verified subject matter experts
