Changes

Jump to: navigation, search

C Sharp Inheritance

No change in size, 16:11, 22 January 2008
An Example of Inheritance
</pre>
This class does a good job of defined defining characteristics common to any type of bank account, such as account holder name, account number and current balance. Imagine, however, that our backing banking program needs to support a number of specific types of account. For example, the bank might offer it's customers an interest bearing savings account. A savings account will have all the characteristics of our ''BankAccount'' class but would also need a way to store the prevailing interest rate. One option would be to create a brand new class from the ground up called ''SavingsAccount'' which duplicates everything we have in our ''BankAccount'' class, plus extra members needed for a savings account. Another, more efficient method is to derive a ''SavingsAccount'' class from the ''BankAccount'' class and then add in the extra functionality into this sub classsubclass.
== Creating a Subclass in C# ==

Navigation menu