This is probably a simple thing to fix. I'm a university student and we just started polymorphism, so the concept is still puzzling to me.
abstract class IncreaseTransaction
{
private string _Description;
private decimal _Amount;
protected IncreaseTransaction(string description, decimal amount)
{
_Description = description;
_Amount = amount;
}
}
class Deposit : IncreaseTransaction
{
public Deposit(string description, decimal amount) : base("Deposit", amount)
{
}
}
static void Main(string[] args)
{
Customer fred = new Customer("Fred");
SavingsAccount fredSavings = new SavingsAccount();
fredSavings.AddTransaction(new Deposit(500.00M));
}
When a new deposit is instantiated, I want the literal string "Deposit" to be used as the description for the transaction. However, I'm getting an error stating 'SampleNamespace.Deposit does not contain a constructor that takes one argument'. So, the string is not being inherited, and I am unsure how to fix this. I would greatly appreciate any help!