11.2 A Swift Inheritance Example
As with most programming concepts, the subject of inheritance in Swift is perhaps best illustrated with an example. In “The Basics of Swift Object-Oriented Programming” we created a class named BankAccount designed to hold a bank account number and corresponding current balance. The BankAccount class contained both properties and instance methods. A simplified declaration for this class is reproduced below:
class BankAccount {
var accountBalance: Float
var accountNumber: Int
init(number: Int, balance: Float)
{
accountNumber = number
accountBalance = balance
}
func displayBalance()
{
...