0
How can I get 50 as the output
From the initializer block, I want to add the local variable age to the A.age member so that 50 is printed to the console. How can I reference A.age in this sample https://code.sololearn.com/cLpfLU7GBgJn/?ref=app
2 ответов
+ 2
if U want to add 25 to the A age variable you can use the super keyword:
println(age + super.age)
+ 2
init {
val age = 25
println(this.age + age)
}