T
TomB
I'm sure this is OOP 101 but I'm confused.
I'm writing a simple accounting type application. I created an abstract
class called IAccount, which my other account types are derived from.
Most of the code on the derived classes is repeated. So it occurred to me
that instead of an abstract class I should create a base class with the
basic functionality in it. However; I "need" to prevent that base class
from being instantiated. How would I do that?
I remember reading the "typical" example of a Bank Account Class, where
you'd have a Chequing account and a Savings Account based on it. In that
example they said to change BankAccount to IBankAccount to keep it from
being instantiated, but then I think the deposit and withdrawal methods
would be repeated-even they are the same.
Am I rambling? Thanks for any help.
Tom
I'm writing a simple accounting type application. I created an abstract
class called IAccount, which my other account types are derived from.
Most of the code on the derived classes is repeated. So it occurred to me
that instead of an abstract class I should create a base class with the
basic functionality in it. However; I "need" to prevent that base class
from being instantiated. How would I do that?
I remember reading the "typical" example of a Bank Account Class, where
you'd have a Chequing account and a Savings Account based on it. In that
example they said to change BankAccount to IBankAccount to keep it from
being instantiated, but then I think the deposit and withdrawal methods
would be repeated-even they are the same.
Am I rambling? Thanks for any help.
Tom