Question: Write a destructor for the CarCounter class that outputs the following. End with newline. Destroying CarCounter #include using namespace std; class CarCounter { public: CarCounter();
Write a destructor for the CarCounter class that outputs the following. End with newline.
Destroying CarCounter
#include
class CarCounter { public: CarCounter(); ~CarCounter(); private: int carCount; };
CarCounter::CarCounter() { carCount = 0; return; }
/* Your solution goes here */
int main() { CarCounter* parkingLot = new CarCounter(); delete parkingLot;
return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
