You can see in main Func im passing different objects at function, which is overloaded and have different kind of objects, but when i run same account transfer function only run, anyone can guide what im doing wrong, whats need to be done.
Easy words there are 3 functions made in class ACI Transfer(double balance, class object)
im trying to run all these 3 functions by passing their respected object
#include<iostream>
using namespace std;
class Account {
private:
double balance;
public:
Account(){}
Account(double balance){ this->balance=balance; }
void Deposit(double balance){
cout<<endl<<"Account()"<<endl;
this->balance=balance;
}
void WithDraw(double balance)
{
cout<<endl<<"Account()"<<endl;
if(this->balance>balance){
this->balance=this->balance-balance;
}
else cout<<endl<<"Error"<<endl;
}
void CheckBalance(void)
{
cout<<"Balance: "<<balance;
}
void setBalance(double balance) { this->balance=balance; }
double getBalance(){ return balance; }
};
class InterestAccount : public Account {
private:
double Interest;
public:
InterestAccount(double Interest,double balance) : Account(balance){ this->Interest=Interest; }
InterestAccount(){ Interest=0.30; }
void Deposit(double balance)
{
cout<<endl<<"InterestAcc()"<<endl;
balance=balance*Interest;
setBalance(balance);
}
};
class ChargingAccount : public Account{
private:
double fee;
public:
ChargingAccount(){}
ChargingAccount(double fee,double balance) : Account(balance) { this->fee=fee; }
void WithDraw(double balance){
cout<<endl<<"ChargingAcc()"<<endl;
if(getBalance()+3>balance){
balance=getBalance()-balance;
setBalance(balance);
}
else cout<<endl<<" ERROR "<<endl;
}
};
class ACI : public InterestAccount, public ChargingAccount
{
public:
ACI(){
}
ACI(double fee,double balance,double Interest) : InterestAccount(Interest,balance), ChargingAccount(fee,balance) { }
void transfer(double balance,Account ACC){
cout<<"Account";
ACC.setBalance(balance);
}
void transfer(double balance,double fee,InterestAccount IG){
cout<<"InterestAcc";
IG.setBalance(balance);
}
void transfer(double balance,double fee,ChargingAccount CG){
cout<<"ChargingACC OBJ";
CG.setBalance(balance);
}
};
int main()
{
double balance=10000;
// cout<<"Enter Balance to transfer: ";
// cin>>balance;
ChargingAccount CG;
InterestAccount IR;
ACI obj;
obj.transfer(balance,CG);
obj.transfer(balance,IR);
}
transfer(double balance, SomeClass object), but in fact there is only one function of that form.