□ Deallocate memory for kitchenpaint using the delete operator. Note: Destructors, which use the "~" character, are expl
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
□ Deallocate memory for kitchenpaint using the delete operator. Note: Destructors, which use the "~" character, are expl
class PaintContainer { public: ~PaintContainer(); double gallonPaint;};
PaintContainer::~PaintContainer() { // Covered in section onDestructors. cout << "PaintContainer deallocated." <<endl;}
int main() { PaintContainer* kitchenPaint;
kitchenPaint = new PaintContainer; kitchenPaint->gallonPaint = 26.3;
/* Your solution goes here */
return 0;}
□ Deallocate memory for kitchenpaint using the delete operator. Note: Destructors, which use the "~" character, are explained in a later section. CHALLENGE 11.3.2: Deallocating memory ACTIVITY 397756.2392630.qx3zqy7 1 #include <iostream> 2 using namespace std; 3 4 class PaintContainer { 5 public: ~PaintContainer(); double gallonPaint; 6 7 8}; 9 10 PaintContainer::~PaintContainer() { // Covered in section on Destructors. cout << "PaintContainer deallocated." << endl; 11 12} 13 14 int main() { 15 PaintContainer* kitchenpaint; 16 17 kitchenpaint = new PaintContainer; 18 kitchenpaint->gallonPaint = 26.3; All tests