napperley
12/02/2019, 10:00 PMinline class ColourPair(val id, val backgroundColour: Int, val foregroundColour: Int) {
fun generatePairValue(): Int {
// ...
}
}
Mike
12/02/2019, 10:12 PMnapperley
12/02/2019, 10:26 PMMike
12/03/2019, 3:32 AMgeneratePairValue
. Is that what you want? But if you still want access to the properties too, then I don't see how inline
could possibly work.
What am I missing here?Derek Peirce
12/03/2019, 6:57 AMJoffrey
12/20/2019, 10:56 AMinline
class would come in (as long as project Vlahalla doesn't make it to the JVM). However, if other properties aren't needed, then there is already the option of providing the 3 values to a secondary constructor, and the computed value as the single inline class property:
inline class ColourPair(val computed: Int) {
constructor(
id: Int,
backgroundColour: Int,
foregroundColour: Int
): this(TODO("computation here"))
}