Answered step by step
Verified Expert Solution
Question
1 Approved Answer
int Composition Defi ne a Person class that has the following private data members: a string to store the rson's name, an integer to store
int Composition Defi ne a Person class that has the following private data members: a string to store the rson's name, an integer to store the number of vehicles, and a dynamically-allocated array of Vehicle objects. Be sure your class has the appropriate constructors accessor functions, and mutator functions, as well as a copy constructor, a destructor and an assignment operator (which we need because the class contains a pointer to dynamically-allocated memory). Define a Vehicle class that has private data member to store the type of vehicle (such as "bike", "car, "motorcycle', etc.) as a string. Create the appropriate constructors, accessor functions, and mutator functions for the class. Write an application that satisfies the following requirements: Write a local function, void printPersonInfo (Person p), to print the information about a Person. This will print the Person's data members and Vehicle types. . In main(): Create a Person object. Ask the user for the information to set the data members for the Person. Create the dynamically-allocated array of Vehicle objects for the Person. Ask the user for the information to set all the Vehicle types. Call printPersonInfo() to print the person information with vehicle names. o o o o o exson Pnjake
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