T
tshad
If I have the following classes where I am overloading (overriding) a method
from the base classes (in this case - Withdraw), I can get to the inherited
classes method by using base.method.
******************************************
public class BankAccount
{
// Withdrawal - you can withdraw any amount up to the
// balance; return the amount withdrawn
virtual public void Withdraw(double dWithdraw)
{
Console.WriteLine(" calls BankAccount.Withdraw()");
}
}
// SavingsAccount - a bank account that draws interest
public class SavingsAccount : BankAccount
{
override public void Withdraw(double dWithdrawal)
{
base.Withdraw(200);
Console.WriteLine(" calls SavingsAccount.Withdraw()");
}
}
// SpecialSaleAccount - account used only during a sale
public class SpecialSaleAccount : SavingsAccount
{
override public void Withdraw(double dWithdrawal)
{
base.Withdraw(200);
Console.WriteLine(" calls SpecialSaleAccount.Withdraw()");
}
}
*********************************************************
But in the SpecialSaleAccount - can I get to the base class of the inherited
class (BankAccount) directly?
Thanks,
Tom
from the base classes (in this case - Withdraw), I can get to the inherited
classes method by using base.method.
******************************************
public class BankAccount
{
// Withdrawal - you can withdraw any amount up to the
// balance; return the amount withdrawn
virtual public void Withdraw(double dWithdraw)
{
Console.WriteLine(" calls BankAccount.Withdraw()");
}
}
// SavingsAccount - a bank account that draws interest
public class SavingsAccount : BankAccount
{
override public void Withdraw(double dWithdrawal)
{
base.Withdraw(200);
Console.WriteLine(" calls SavingsAccount.Withdraw()");
}
}
// SpecialSaleAccount - account used only during a sale
public class SpecialSaleAccount : SavingsAccount
{
override public void Withdraw(double dWithdrawal)
{
base.Withdraw(200);
Console.WriteLine(" calls SpecialSaleAccount.Withdraw()");
}
}
*********************************************************
But in the SpecialSaleAccount - can I get to the base class of the inherited
class (BankAccount) directly?
Thanks,
Tom