📅  最后修改于: 2022-03-11 14:53:34.485000             🧑  作者: Mango
open class Shape {
open val vertexCount: Int = 0
open fun draw() { /*...*/ }
fun fill() { /*...*/ }
}
class Rectangle() : Shape() {
override fun draw() { /*...*/ } // overrides method
override val vertexCount = 4 // overrides property, can be set later
}
class Losange(override val vertexCount: Int = 4) : Shape
// Always has 4 vertices, can't be set later