Question: Complete the CityNode class destructor. The destructor prints Deallocating CityNode ( , followed by the value of name, a space, and the value of

Complete the CityNode class destructor. The destructor prints "Deallocating CityNode (", followed by the value of name, a space, and the value of population, and then ")". End with a newline.
Ex: If the input is Bow 3190, then the output is:
Deallocating CityNode (Bow 3190)
#include
using namespace std;
class CityNode {
public:
CityNode(string nameValue, int populationValue){
name = nameValue;
population = populationValue;
}
/* Your code goes here */
string name;
int population;
CityNode* next;
};
int main(){
CityNode* myCity;
string inputString;
int inputValue;
cin >> inputString;
cin >> inputValue;
myCity = new CityNode(inputString, inputValue);
delete myCity;
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 Programming Questions!