January 2018
Intermediate to advanced
434 pages
14h 1m
English
Now we will see how to work with a nested class in the following steps:
fun main(args: Array<String>) { var a1 = outCl() a1.printAB() outCl.inCl().printB()}class outCl {var a = 6 fun printAB () { var b_ = inCl().b println ("a = $a and b = $b_ from inside outCl")} class inCl { var b = "9" fun printB() { println ("b = $b from inside inCl") } }}
Here's the output:
a = 6 and b = 9 from inside outClb = 9 from inside inCl
fun main(args: Array<String>) { var a = outCl() a.printAB() ...Read now
Unlock full access