Paul Woitaschek
05/13/2019, 4:19 PMinline class Calories(val value : Double)
But now I lose all functionallity of double. If I for example want to sum, substract or divide calories, I need to re-implement these basic math functions ontop of the Calories class as operator fun plus etc.Ruckus
05/13/2019, 4:22 PMCalories to be another name for Double, you use a typealias.kunalsheth
05/13/2019, 4:23 PMPaul Woitaschek
05/13/2019, 4:36 PMPaul Woitaschek
05/13/2019, 4:37 PMtypealias Calories = Double
typealias Gram = Double
fun Calories.bmr() {
}
fun mistake(gram: Gram){
gram.bmr()
}Ruckus
05/13/2019, 4:39 PMdave08
05/14/2019, 6:50 AMinline class Calories(val value: Double) : Double by value would work...?hho
05/14/2019, 8:31 AMInline class cannot implement an interface by delegationRuckus
05/14/2019, 1:30 PMDouble is not an interfacedave08
05/14/2019, 4:33 PM