object Helloword {
}
/*是上述的伴生类*/
class Helloword{
var name = "唐三"
/*辅助构造器*/
/*多个参数逗号分隔*/
def this(name:String){
this()
println("执行辅助构造器")
this.name=name
}
}
-----------------------------------------------
/*类名后面的样式是主构造*/
class Helloword2(x:String){
/*重载*/
def this(sex:int){
this(x)
this.sex = sex
}
}