3

I honestly don't know why this is throwing me off.

 public abstract class BankAccount
    {
        private string accNo;
        private double balance;


        public abstract void MakeWithdrawal(string acc);
        public abstract void MakeDeposit(double dep);

The above code is throwing this error:

BankAccount.MakeWithdrawal()' is abstract but it is contained in non-abstract class 'Worksheet7.BankAccount'

This is even though i declared the class as abstract. Is there something I'm missing here or a perquisite in visual studio I'm missing?

Prince John Wesley
  • 62,492
  • 12
  • 87
  • 94
OVERTONE
  • 11,797
  • 20
  • 71
  • 87

1 Answers1

10

I suspect that you have some other class called BankAccount in the Worksheet7 namespace which is not defined as abstract. The following code compiles just fine:

public abstract class BankAccount
{
    private string accNo;
    private double balance;

    public abstract void MakeWithdrawal(string acc);
    public abstract void MakeDeposit(double dep);
}

So the error message is not on this class. It is on another class with the same name defined in a different namespace.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928