Quiz: Extensions
Test your understanding of the concepts discussed in this chapter.
We'll cover the following...
We'll cover the following...
Technical Quiz
1.
What is the output of the following code?
open class View
class Button : View()
fun View.printMe() {
println("I'm a View")
}
fun Button.printMe() {
println("I'm a Button")
}
fun main() {
val button: Button = Button()
button.printMe()
val view: View = button
view.printMe()
}
A.
I'm a Button
I'm a Button
B.
I'm a View
I'm a Button
C.
I'm a Button
I'm a View
D.
I'm a View
I'm a View
1 / 5
...