Reply to thread

ok Ill try to be as clear as possible


The implementation of CanDebit is in the class CurrenAccount, which is a subclass of BankAccount. Now I wish to use CanDebit in the superclass Bankaccount.


Heres some code :


     BankAccount.cs :


using System;


namespace Reeks6

{

    abstract class BankAccount

    {

        //constructor

       

        public void Debit(double amount)

        {

            if (CanDebit(amount))

            {

                balance -= amount;

                Console.Write("Debit succeeded ");

            }

        }

         {

}




    CurrentAccount.cs :


using System;


namespace Reeks6

{

    //constructor (inherits BankAccount)

       

public bool CanDebit(double amount)

        {

            if (amount <= balance + overdraftLimit)

            {

                return true;

            }

            else

            {

                return false;

            }

        }


Back
Top