Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Normal
ok Ill try to be as clear as possibleThe 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; } }
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 :
//constructor (inherits BankAccount)
public bool CanDebit(double amount)
if (amount <= balance + overdraftLimit)
return true;
else
return false;