Define a class for a bank account that includes the followin
Solution
class BankAccount
{
//Name of depositor
string depositorName;
//account number
int accountNumber;
//type of account
string typeOfAccount;
//balance amount in account
float balance;
/*A constructor will have exact same name as the class name and it does not have any return type at all, not even void. Constructors can be very useful for setting initial values for certain member variables.*/
BankAccount();
//Member functions can be defined within the class definition or separately using scope resolution operator ::.
// Deposit Function
Deposit(float amount)
{
balance=balance + amount;
return balance;
}
// withdraw function
Withdraw(float amount)
{
balance=balance - amount;
return balance;
}
// Display function
Display(string name, float blance)
{
// it will display name and balance
}
};
---------------------------------------------------------------------------------------------
If you have any query, please feel free to ask.
Thanks a lot.
