kotlin abstract classes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

kotlin abstract classes

Abstraction You decide to make the Component class abstract, since you are not going to create objects of that type. You also add a show() function to it that the derived classes need to override. For a Button, the show() function should output: "Showing a Button", while for an Image it should output: "Showing an Image".

26th Nov 2022, 1:36 PM
mesuli mkhize
mesuli mkhize - avatar
1 Answer
+ 3
This is the practice 32.2 in the Kotlin course. You need to write the concrete implementation of the show function in both subclasses of Component. override fun show() { ... } And what is YOUR question?
26th Nov 2022, 4:18 PM
Tibor Santa
Tibor Santa - avatar