Copyright © 1998 Sita Ramakrishnan, Monash University All rights reserved

Light Views

HomeCase StudiesOO TheoryHelp

Inheritance, polymorphism and regression testing

The following diagram shows examples of both inheritance and polymorphism.

You can select between creating SAVINGS_ACCOUNT object and a CHEQUE_ACCOUNT by clicking on the appropriate cross. Similarly, you can also select between creating a super class reference to the object or a sub class reference to the object. Clicking on the display or show_balance function will cause the appropriate Eiffel code to generated and displayed, along with the code output.

Although not shown in the diagram, the display method of the SAVINGS_ACCOUNT and CHEQUE_ACCOUNT displays is simple "Hello..." message as well as the current balance. The ACCOUNT show_balance method simply displays the balance.

 

So how does this tie into inheritance regression testing? Easy. If you have written a test case to test the show_balance method of the ACCOUNT class, you can reuse this test to use the SAVINGS_ACCOUNT and CHEQUE_ACCOUNT classes.

 


Funded by Committee of University Teaching And Staff Development (CUTSD) through DEETYA, 1998

 


Disclaimer