agrosner
04/30/2018, 6:21 PMtypealias Coordinate2D = Triple<Int, Int, String>
operator fun Coordinate2D.invoke(x: Int, y: Int, description: String) = Coordinate2D(x, y, description)
Ruckus
04/30/2018, 6:23 PMagrosner
04/30/2018, 6:40 PMtypealias
to Triple
of a certain type thats called Coordinate2D
and gives it named argumentsRuckus
04/30/2018, 6:45 PMoperator fun Coordinate2D.invoke
works on an instance of Triple<Int, Int, String>
, so it would be used like so:
val tri = Triple(5, 6, "test")
val coord = tri(7, 8, "test-2")
I think you want
fun Coordinate2D(x: Int, y: Int, description: String): Coordinate2D = Triple(x, y, description)
agrosner
04/30/2018, 6:46 PMcoordinate()
. haha.