Changes

Jump to: navigation, search

C Sharp Inheritance

4 bytes added, 15:50, 1 April 2009
no edit summary
In [[C Sharp Object Oriented Programming|C# Object Oriented Programming]] we looked at the basics of object oriented programming in C#. Now that we have covered these basics the next topic to be covered is that of class inheritance.
== What is Inheritance? ==
</pre>
<google>ADSDAQBOX_FLOW</google>
This class does a good job of defining characteristics common to any type of bank account, such as account holder name, account number and current balance. Imagine, however, that our banking program needs to support a number of specific types of account. For example, the bank might offer it's its 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 subclass.
== Creating a Subclass in C# ==

Navigation menu