Answer to Question #174362 in C++ for Smith

Question #174362

Develop a code for the hierarchical inheritance for banking account,


· The Bank_ACC base class consisting of data members such as accno and name, and member functions get() and display().


· The SB_ACC derived class inherited from Bank_ACC class, consisting of data members such as roi, and member functions get() and display().


· The CUR_ACC derived class inherited from Bank_ACC class, consisting of data members such as odlimit, and member functions get() and display().



1
Expert's answer
2021-03-22T11:47:40-0400
#include<iostream>
using namespace std;
class Bank_ACC
{
    public:
    int accno;
    char name;
    void get();
    void display()
    {
        cout<<"Enter the accno and name of the account holder: ";
        cin>>accno>>name;
    }
};
class SB_ACC : public Bank_ACC
{
    public:
     float roi;
     void get();
     void display()
     {
         cout<<"Enter rate of interest: ";
         cin>>roi;
     }
};
class CURR_ACC : public Bank_ACC
{
    public:
    int odlimit;
    void get();
    void display()
    {
        cout<<"Enter the limit: ";
        cin>>odlimit;
    }
};
int main()


{ 
     SB_ACC obj1;
     CURR_ACC obj2;
     obj1.get();
     obj1.display();
     obj2.get();
     obj2.display();
     return 0;
    


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS