Override and Super question


When we’re implementing Zombie, we use override to provide the zombie class with its own definition of terrorizeTown(). However, we than turn around and use super to call Monster’s implementation of terrorizeTown(). Why do we need to use super or call Monster’s implementation of terrorizeTown() when we already defined a “custom” implementation of it. Code below:

[code]override func terrorizeTown() {

        if town?.population >= 10 {
        } else {town?.population = 0}



Strictly speaking, you do not need to to call super.terrorizeTown(). The only thing it contributes in this case is the logging that is done on the superclass’s implementation. More generally, this demonstrates that calling super is how an override leverages the superclass’s code.