Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
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