Skip to content

Instantly share code, notes, and snippets.

@AnthonyBY
Created October 5, 2023 08:07
Show Gist options
  • Save AnthonyBY/17de3579e20cdb6fcdac5b4135d6a839 to your computer and use it in GitHub Desktop.
Save AnthonyBY/17de3579e20cdb6fcdac5b4135d6a839 to your computer and use it in GitHub Desktop.
Swift class override quiz
import UIKit
class A {
func execute(ind: Int = 0) {
print("A: \(ind)")
}
}
class B: A {
override func execute(ind: Int = 1) {
print("B: \(ind)")
}
}
let instance: A = B()
instance.execute()
// 1) A:0 2) B:0 3) A:1 4) B:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment