So, what's the problem with an abstract factory me...
# language-proposals
d
So, what's the problem with an abstract factory method?
Copy code
abstract 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)
    ...