Intro to Object Orientated Programming Part 6 - Overloading methods

PlausiblyDamp

Staff member
Joined
Sep 4, 2002
Location
Lancashire, UK
User Rank
*Expert*
Guide to Object Orientated code in .Net

This is a continuation of the series started in here and is preceded by this thread

Introduction
In the previous article we looked at how we could use inheritance to simply the creation of a SavingsAccount class, which contains additional functionality over the BankAccount class, with minimal need to duplicate code and no requirement to alter existing code to work with the new class.
The ability to extend a class in this way can be very useful when developing software, however the ability to change how a derived class implements methods defined in the base class can be very powerful. Imagine our fictitious bank wishes to impose a 1% surcharge on all withdrawals made on Savings Accounts, what we would like is to be able to make this change without having to rewrite existing code that uses our BankAccount and SavingsAccount classes.

A Solution?
In a more traditional procedural application we would need to implement this logic at any point where we debit an account
 

Attachments

  • BankCS.zip
    7.8 KB · Views: 14
  • BankVB.zip
    6.8 KB · Views: 9
Top