DT大数据 scala 内部类
scala内部类 DT大数据梦工厂scala的所有视频、PPT和代码在百度云盘的链接:http://pan.baidu.com/share/home?uk=4013289088#category/type=0&qq-pf-to=pcqq.group
《Scala深入浅出实战初级入门经典视频课程》http://edu.51cto.com/lesson/id-66538.html
《Scala深入浅出实战中级进阶经典视频课程》http://edu.51cto.com/lesson/id-67139.html class Teacher private (val name : String, val age : Int){ println("This is the primary constructor!!!") var gender : String = _ println(gender) def this(name : String, age : Int, gender : String){ this(name, age) this.gender = gender } }
class Outer(val name: String) { outer => class Inner(val name: String){ def foo(b:Inner) = println("Outer: " + outer.name + " Inner: " + b.name) } } object OOPInScala{ def main(args: Array[String]) { val outer1 = new Outer("Spark") val outer2 = new Outer("Hadoop") val inner1 = new outer1.Inner("Scala") val inner2 = new outer2.Inner("Java") inner1.foo(inner1); inner2.foo(inner2); // val p = new Teacher // p.name = "Spark" // // p.sayHello // val p = new Teacher("Spark", 5) // println(" : " + p.age) // val p = new Teacher("Spark", 5 , "male") // println(" : " + p.age) } }