+ 1
Kotlin practice 32.2 Abstract classes
Can anyone help me with this question, please and thank you. 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". Implement the required show() function to generate the expected output. // my code https://code.sololearn.com/cgGM09i5ZZ4l/?ref=app
6 Antworten
+ 4
You'll probably kick yourself.
I think you have too many printed lines. Also, you need to match the expected output exactly. You don't have the same capital letters, and you have a space at the end of your button line.
So, not:
println("Showing a button ")
println("Showing an image")
But:
println("Showing a Button")
println("Showing an Image")
+ 2
Hi Brent, you have linked the task, not your code (unfortunately, it's not so straightforward).
To link your code, you need to copy your attempt from the task, go to the create tab (the code playground), start a new code, paste your attempt there and then you can attach it here.
+ 1
Ausgrindtube i definietly kicked myself anddd with a face palm too. Thank you for the help Lol
+ 1
I've been there for sure.
Coding is sometimes brutally exact! On the plus side, it's what removes human error due to our lazy ape brains.
Happy learning and coding!
0
Ausgrindtube thank you. Will do
0
Ausgrindtube its edited and reposted now. Thanks again for the tutorial