Inheitance Kotlin question
Here is the question which we have to solve and As the images have the same width and height properties, you decide to create a base class called Component and inherit the Button and Image classes from it. The Button class should have its own name property and tap() function, while the Image class should have a draw() function, outputting its height and width in the format: widthheight. So for an image with width of 100 and height of 150, the output should be 100x150. Complete the given code to define the Image class and inherit the Button and Image classes from the Component class. Note, that width and height are Integers, so in order to concatenate them to a string you need to convert them using the toString() function: width.toString() Here is my code but i dont know where i have done mistakes please one retify my mistake and tell me which position i have to modify the code open class Component(var width: Int, var height: Int) { } open class Button(width: Int, height: Int):Component { var name: String = "Button" fun tap() { println(name + " was tapped") } } class Image(width:Int, height:Int):Button{ fun draw(){ println(width.toString+"x"+height.toString) } } fun main(args: Array<String>) { val b1 = Button(200, 50) b1.tap() val img = Image(300, 500) img.draw() }