In Kotlin, let's consider the following class with nullable types and member functions:
class ComplexCalculation {
var value: Int? = null
var valueSqr: Int? = null
fun calculate(): Int {
// some complex calculations
return result
}
fun calculateSqr(): Int {
// calculate square
return square
}
}
What are the correct ways to initialize both 'value' and 'valueSqr' lazily using respective functions inside 'ComplexCalculation' class instance 'compCalc'?