Changes

Jump to: navigation, search

C Sharp Inheritance

No change in size, 18:01, 1 February 2016
m
Text replacement - "<google>ADSDAQBOX_FLOW</google>" to "<htmlet>adsdaqbox_flow</htmlet>"
}
</pre>
<googlehtmlet>ADSDAQBOX_FLOWadsdaqbox_flow</googlehtmlet>
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 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.

Navigation menu