dmitry.petrov
03/27/2017, 10:40 AMabstract class Rect<NumberType: Number, PointType: Point<NumberType>, SizeType: Size<NumberType>>(
val origin: PointType,
val size: SizeType
) {
abstract fun create(x: NumberType, y: NumberType, width: NumberType, height: NumberType) // <== Factory function declared abstractly
...
open fun copy(
newX: NumberType = this.x,
newY: NumberType = this.y,
newWidth: NumberType = this.width,
newHeight: NumberType = this.height
): Rect<NumberType, PointType, SizeType>
= create(newX, newY, newWidth, newHeight)
...