Created
October 5, 2023 08:07
-
-
Save AnthonyBY/17de3579e20cdb6fcdac5b4135d6a839 to your computer and use it in GitHub Desktop.
Swift class override quiz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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