scala 构造函数
Scala构造函数 (Scala constructors)
A constructor is a function that is called at the time of initialization of objects. A constructor is just like a method of a class that contains instructions to be executed. The constructor has the same name as the class and is called when the object of the class is initialized.
构造函数是在对象初始化时调用的函数。 构造函数就像包含要执行指令的类的方法一样。 构造函数与类具有相同的名称,并在初始化类的对象时调用该构造函数。
Scala programming language defines two types of constructors,
Scala编程语言定义了两种类型的构造函数 ,
Primary constructor
主要构造函数
Auxiliary constructor
辅助构造函数