Question: Write the code for a constructor of class CargoShip. The tonnage should be set to 54000, the speed should be set to 0, and

 Write the code for a constructor of class CargoShip. The tonnage should be set to 54000, the speed should be   Given: class BoxContainer ( }; int inventory; string contents; class CargoShip ( private: int tonnage; double 

Write the code for a constructor of class CargoShip. The tonnage should be set to 54000, the speed should be set to 0, and the fuel should be set to 2000000. Then a for loop should allocate memory to 10 BoxContainer Objects and add them to the vector cargo. Part 2: Write the code for a destructor of class CargoShip. The destructor should deallocate the memory from the vector cargo. Given: class BoxContainer ( }; int inventory; string contents; class CargoShip ( private: int tonnage; double speed; double fuel; vector

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

The task provided outlines the requirements for constructing and destructing a CargoShip class as we... View full answer

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!