Is there way to avoid initialisation crash? ```abs...
# kotlin-native
p
Is there way to avoid initialisation crash?
Copy code
abstract class A {
	
	init {
		foo()
	}

	abstract fun foo()
}

class B : A {
	val b = /* init b */

	override fun foo() {
		b.something() // crash
	}
}
The super class call
foo()
on init so, the property
b
is not yet initialised
r
You could call
foo()
later one way or another, or implement
foo()
through composition instead of inheritance, or somehow pass the information you're trying to convey with
foo()
implementation through the super constructor, etc.
It's also not a Kotlin/Native issue
e
there should be a warning in IntelliJ when viewing
A
, something like "Calling non-final function foo in constructor"