#include<iostream>
using namespace std;
class Asset //here i make 1st class name Asset
{
protected: //here i declare data members
int id;
string type;
public: //here i declare mamber function
void getdataA(int,string);
void setdataA();
};
void Asset::getdataA(int x,string y) //here i define our member function outside the class
{
id=x;
type=y;
}
void Asset::setdataA() //here i define our member function outside the class
{
cout<<"your id is:"<<id<<endl;
cout<<"your account type:"<<type<<endl;
}
class BankAccount: public Asset //here i make 2ed class name BankAccount and inherit with class Asset
{
protected: //here i declare data members
string bank_name;
float balance;
public: //here i declare mamber function
void getdataBA(string,float);
void setdataBA();
};
void BankAccount::getdataBA(string x,float y) //here i define our member function outside the class
{
bank_name=x;
balance=y;
}
void BankAccount::setdataBA() //here i define our member function outside the class
{
cout<<"your bank name is:"<<bank_name<<endl;
cout<<"your balance in your account is:"<<balance<<endl;
}
class Security: public Asset //here i make 3ed class name Security and inherit with class Asset
{
private: //here i declare data members
string trade_exchange_name;
public: //here i declare mamber function
void getdataSY(string);
void setdataSY();
};
void Security::getdataSY(string x) //here i define our member function outside the class
{
trade_exchange_name=x;
}
void Security::setdataSY() //here i define our member function outside the class
{
cout<<"your trade exchange name is:"<<trade_exchange_name<<endl;
}
class RealAsset: public Asset //here i make 4th class name RealAsset and inherit with class Asset
{
private: //here i declare data members
float build_up_Asset;
public: //here i declare mamber function
void getdataRA(float);
void setdataRA();
};
void RealAsset::getdataRA(float x) //here i define our member function outside the class
{
build_up_Asset=x;
}
void RealAsset::setdataRA() //here i define our member function outside the class
{
cout<<"your build_up_Assets are:"<<build_up_Asset<<endl;
}
class SavingAccount:public BankAccount //here i make 5th class name SavingAccount and inherit with class BankAccount
{
private: //here i declare data members
float interest_rate;
public: //here i declare mamber function
void getdataSA(float);
void setdataSA();
};
void SavingAccount::getdataSA(float x) //here i define our member function outside the class
{
interest_rate=x;
}
void SavingAccount::setdataSA() //here i define our member function outside the class
{
cout<<"your interest rate is:"<<interest_rate<<endl;
}
class CheckingAccount:public BankAccount //here i make 5th class name CheckingAccount and inherit with class BankAccount
{
private: //here i declare data members
float over_draft_limit;
public: //here i declare mamber function
void getdataCA(float);
void setdataCA();
};
void CheckingAccount::getdataCA(float x) //here i define our member function outside the class
{
over_draft_limit=x;
}
void CheckingAccount::setdataCA() //here i define our member function outside the class
{
cout<<"your over_draft_limit is:"<<over_draft_limit<<endl;
}
int main()
{
Security obj1; // here i make the object of child class
RealAsset obj2; // here i make the object of child class
SavingAccount obj3; // here i make the object of child class
CheckingAccount obj4; // here i make the object of child class
int a;
string b;
cout<<"please enter your id here:";
cin>>a;
cout<<"please enter your type here:";
cin>>b;
obj1.getdataA(a,b); //here i call member function of class Asset
string s;
cout<<"please enter your trade exchange name here:";
cin>>s;
obj1.getdataSY(s); //here i call member function of class security
float f;
cout<<"please enter your build up Assets:";
cin>>f;
obj2.getdataRA(f); //here i call member function of class realasset
string c;
float d;
cout<<"please enter your bank name here:";
cin>>c;
cout<<"please enter your balance here:";
cin>>d;
obj3.getdataBA(c,d); //here i call member function of class BankAccount
float i;
cout<<"please enter your interest rate here:";
cin>>i;
obj3.getdataSA(i); //here i call member function of class Saving account
float o;
cout<<"please enter your over draft limit:";
cin>>o;
cout<<endl;
cout<<"-----------------Full information----------------------"<<endl;
obj4.getdataCA(o); //here i call member function of class checking account
obj1.setdataA(); //here i call member function of class Asset
obj3.setdataBA(); //here i call member function of class BankAccount
obj3.setdataSA();//here i call member function of class Saving account
obj2.setdataRA(); //here i call member function of class realAsset
obj1.setdataSY(); //here i call member function of class security
obj4.setdataCA(); //here i call member function of class checking account
cout<<endl;
cout<<"--------------------------------------------------------"<<endl;
}
No comments:
Post a Comment