Question: In C++ Write a program that contains a class called VideoGame. The class should contain the member variables: Name price rating Specifications: Dynamically allocate all
In C++
Write a program that contains a class called VideoGame. The class should contain the member variables:
Name price rating
Specifications:
Dynamically allocate all member variables. Write get/set methods for all member variables. Write a constructor that takes three parameters and initializes the member variables. Write a destructor. Add code to the destructor. In addition to any other code you may put in the destructor you should also add a cout statement that will print the message Destructor Called. Figure out where to allocate and release memory. Create an instance of VideoGame in main. You should set the values on the instance and then print them out on the console.
Modify the previous program. Make the following changes:
Inside of main create a dynamically allocated two element array of VideoGame objects. Set the values of both elements of the array. Make sure you release memory allocated to the array. Write a method on the VideoGame class called Show that will display the values of all member variables. Write a loop that will iterate through the array and display the contents of each VideoGame object.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
