Complete the code to override the method describe() in the subclass.
class Animal { func describe() { print("I am an animal.") } } class Dog: Animal { override func [1]() { print("I am a dog.") } }
override keyword.describe() is overridden by using the exact same method name with the override keyword.Complete the code to override the computed property description in the subclass.
class Vehicle { var description: String { return "A vehicle" } } class Car: Vehicle { override var [1]: String { return "A car" } }
override keyword.description is overridden by using the exact same property name with the override keyword.Fix the error in the code by correctly overriding the method makeSound().
class Bird { func makeSound() { print("Chirp") } } class Parrot: Bird { override func [1]() { print("Squawk") } }
override keyword.makeSound() is overridden by using the exact same method name with the override keyword.Fill both blanks to override the property speed with a getter and setter.
class Machine { var speed: Int = 0 } class Car: Machine { override var [1]: Int { get { return super.[2] } set { super.speed = newValue } } }
super access.override keyword.speed in both places to correctly override the property and access the superclass property.Fill both blanks to override a method with parameters and call the superclass method inside.
class Printer { func printMessage(_ message: String) { print("Printer: \(message)") } } class ColorPrinter: Printer { override func [1](_ message: String) { print("ColorPrinter:") super.[2](message) print("Done printing.") } }
printMessage to override correctly and call the superclass method with super.printMessage(message).