bbaldino
01/30/2020, 11:03 PMfun <T : Any> T.double(num: Int): Int = num * 2
abstract class Parent(val num: Int)
// Works
class Child(
num: Int
) : Parent(double(num)) {
private companion object
}
// Error: unresolved reference 'double'
class Child2(num: Int) : Parent(double(num))
diesieben07
01/30/2020, 11:05 PMthis
) cannot be leaked to outside functions here, because the object is not yet fully constructed.diesieben07
01/30/2020, 11:05 PMdouble
function even have a receiver? It's not used...bbaldino
01/30/2020, 11:05 PMbbaldino
01/30/2020, 11:05 PMbbaldino
01/30/2020, 11:08 PM