Question: C++ helps instructions Create a class named Counter that contains an int ID and a static int count. The default constructor should begin as follows:

C++ helps

instructions

Create a class named Counter that contains an int ID and a static int count. The default constructor should begin as follows:

Counter( ) : ID(count++) {

It should also print its ID and that it's being created. The destructor should print that it's being destroyed and its ID. Do not decrement the count value in the destructor.

Submit your class in a file named Counter.h. Your class will be tested with the countingClasses.cpp file.

use the following code, do not modify the following code.

#include  #include "Counter.h" int Counter::count = 0; int main(int argc, const char * argv[]) { Counter * myCounter = new Counter; Counter * anotherCounter = new Counter; delete myCounter; delete anotherCounter; return 0; } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!