Scala 内部类
package scala_learn.demo02_oop
/**
* Created by liguohua on 2017/8/1.
*/
class Outer(var name:String){
outer=> class Inner(var name:String){
def find(): Unit ={
println(this.name)
}
def findx(): Unit ={
println(this.name+","+outer.name)
}
def check(in:Inner): Unit ={
println("哈哈")
}
}
def find(): Unit ={
println(this.name)
}
}
object O3_InnerClass {
def main(args: Array[String]): Unit = {
val t = new Outer("tiesan1")
println(t.name)
t.find()
val s = new t.Inner("sunwukong1")
println(s.name)
s.find()
s.findx()
val t2=new Outer("tie")
val s1=new t2. Inner("sun1")
s1.check(s1)
s.check(s)
}
}