Question: Composition Define a Person class that has the following private data members: a string to store the person's name, an integer to store the number

 Composition Define a Person class that has the following private data

Composition Define a Person class that has the following private data members: a string to store the person's name, an integer to store the number of bank accounts, and a dynamically allocated array of BankAccount 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 BankAccount class that has private data member to store the account number as an integer. 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 BankAccount account numbers In main(): o Create a Person. o Ask the user for the information to set the data members for the Person. o Create the dynamically-allocated array of BankAccount objects for the Person. Ask the user for the information to set all the BankAccount account numbers Call printPersonInfo () to print the person information with account numbers o o

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 Databases Questions!