I\'m having an error message that tells me this:
\'BankAccount.account\' does not contain a definition for \'withdraw\'.
Here\'s my code:
using S
It looks like you simply missed the method from the base type:
public virtual void Deposit(float amt)
{
balance += amt;
}
public virtual void Withdraw(float amt)
{
balance -= amt;
}
Note I changed "deposit" to +=
, and made the method virtual
so that subclasses can override
the method, which is (I strongly suspect) what the intent is here. Additionally, float
is a really bad choice for storing money. decimal
might be a better choice. As a stylistic change, I also capitalized the names.