Question: Revise the baseDMA-lacksDMA-hasDMA class hierarchy so that all three classes are derived from an ABC. Test the result with a program similar to the one

Revise the baseDMA-lacksDMA-hasDMA class hierarchy so that all three classes are derived from an ABC. Test the result with a program similar to the one in Listing 13.10. That is, it should feature an array of pointers to the ABC and allow the user to make runtime decisions as to what types of objects are created. Add virtual View() methods to the class definitions to handle displaying the data.

Listing 13.10.

Listing 13.10 usebrass2.cpp // usebrass2.cpp // compile with brass.cpp #include #include #include"brass.h" const int CLIENTS = 4; int main() { -- using std::cin;

Listing 13.10 usebrass2.cpp // usebrass2.cpp // compile with brass.cpp #include #include #include "brass.h" const int CLIENTS = 4; int main() { -- using std::cin; using std::cout; using std::endl; polymorphic example Brass p_clients [CLIENTS]; std::string temp; long tempnum; double tempbal; char kind; for (int i = 0; i < CLIENTS; i++) { cout < tempnum; cout < < "Enter opening balance: $"; cin >> tempbal; cout < < "Enter 1 for Brass Account or " < < "2 for BrassPlus Account: "; while (cin >> kind && (kind != '1' && kind != '2')) cout

Step by Step Solution

3.39 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

class Brass protected double balance public Brassconst stdstring s Nullbody long an 1 double bal 00 ... View full answer

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 Introduction Java Program Questions!