Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Having issues with C++ pointers and classes would appreciate some help This is an example of the expected use: Showroom showroom(Primary Showroom, 3); showroom.AddVehicle(&vehicles[0]); showroom.AddVehicle(&vehicles[1]);
Having issues with C++ pointers and classes would appreciate some help
This is an example of the expected use:
Showroom showroom("Primary Showroom", 3); showroom.AddVehicle(&vehicles[0]); showroom.AddVehicle(&vehicles[1]);Showroom The Showroom class is a bit more sophisticated. Its purpose is to store an array of Vehicle objects. Each Showroom that you create could have a different number of Vehicles, so you will have to use dynamic memory allocation in this case. Your Showroom should contain variables for the following: The name of the Showroom A pointer to the array of Vehicles, and because pointers don't have any addition info on their own... A maximum capacity of the array A count of how many Vehicles you currently have In addition, you should create the following functions (plus the special functions-a copy constructor, assignment operator, and destructor): // Store a Vehicle in the first available spot void AddVehicle (const Vehicle *v); // Show the name of this object and all of its vehicles void ShowInventory() const; // Accessors const Vehicle *GetVehicleList() const; unsigned int GetCapacity() const; unsigned int GetCount () const; const char GetName() const
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started