This is bank account class:
namespace BankAccount
{
public abstract class BankAccount
{
protected static int numberOfAccounts = 100001;
private double balance;
private string owner;
private string accountNumber;
public BankAccount()
{
balance = 0;
accountNumber = numberOfAccounts + "";
numberOfAccounts++;
}
public BankAccount(string name, double amount)
{
owner = name;
balance = amount;
accountNumber = numberOfAccounts + "";
numberOfAccounts++;
}
public BankAccount(BankAccount oldAccount, double amount)
{
owner = oldAccount.owner;
balance = amount;
accountNumber = oldAccount.accountNumber;
}
}
}
This is Checking account class:
namespace BankAccount
{
class CheckingAccount : BankAccount
{
int fee = 15;
public CheckingAccount(string name, double amount)
{
base.BankAccount(name, amount);
}
public new bool Withdraw(double amount)
{
double totalAmount = amount + fee;
return base.Withdraw(totalAmount);
}
}
}
For, base.BankAccount(name, amount);
I am getting error,
'BankAccount' does not contain a definition for 'BankAccount.'
Bank account is the base class and checking account inherits the base class. and when I remove the base keyword it says:
Non Invokable member cannot be used as a method.
In the main, I created an object, I want to accept a value in Main - a string and a double and then send it to CheckingAccount
class and CheckingAccount
constructor should run and then send the values to BankAccount
constructor and do the calculations.
How can I fix the error
'BankAccount' does not contain a definition for 'BankAccount'
. ? Thanks,