17.6 Adding a Custom Secondary Constructor
As the SavingsAccount class currently stands, it makes a call to the secondary constructor from the parent BankAccount class which was implemented as follows:
constructor(accountNumber: Int, accountBalance: Double) :
super(accountNumber, accountBalance)
Clearly this constructor takes the necessary steps to initialize both the account number and balance properties of the class. The SavingsAccount class, however, contains an additional property in the form of the interest rate variable. The SavingsAccount class, therefore, needs its own constructor to ensure that the interestRate property is initialized when instances of the class are created. Modify the SavingsAccount class one last time to add an additional secondary constructor allowing the interest rate to also be specified when class instances are initialized:
class SavingsAccount : BankAccount {
var interestRate: Double = 0.0
...