Hey
I have a problem of how can i modify the bankAccount in order to count how many instances of the class have been created.
I think of that but the problem is that don't know how to add it to the original program :
private static int instanceCount = 0;
public CountTest()
{
instanceCount++;
}
pubic static int getinstanceCount()
{
return instanceCount;
}
Bank Account
public class BankAccount
{
private int balance;
public BankAccount(int initialBalance)
{
this.deposit( initialBalance );
}
public void withdraw( int amount)
{
balance = balance - amount;
}
public void deposit (int amount)
{
balance = balance + amount;
}
public int getBalance()
{
return balance;
}
}
Thanks in advnace and i hope that someone can help me !