Adaptive Code: Agile coding with design patterns and SOLID principles (Developer Best Practices) by Gary McLean Hall

Adaptive Code: Agile coding with design patterns and SOLID principles (Developer Best Practices) by Gary McLean Hall

Author:Gary McLean Hall [McLean Hall, Gary]
Language: eng
Format: azw3
Publisher: Pearson Education
Published: 2017-04-18T04:00:00+00:00


What you are aiming to achieve is to make it easier to add a new account type while improving the readability of the code. For this, you will take advantage of polymorphism. You will model the account types as different subclasses of the Account class. The Gold account type will be represented by the GoldAccount class, and the same is true of the SilverAccount and PlatinumAccount.

The first step is to define these classes, as shown in Listing 6-3.

Listing 6-3 Each account type is now a distinct class.

Click here to view code image



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.