class A 
    {
        class B; 
        def foo(b:A#B){}  //def foo(b:B){} 后面的a1.foo(b2) 就不能通过编译
    }

    object Main {
        def main(args: Array[String]): Unit = {

            val a1 = new A;
            val b1 = new a1.B;
            val a2 = new A;
            val b2 = new a2.B;
            
            a1.foo(b2); 
        }
    }

  

posted on 2014-05-04 18:24  scala  阅读(500)  评论(0编辑  收藏  举报