构造函数是特殊的成员函数,与其他成员函数不同,构造函数和类同名,而且没有返回类型。
A constructor is a special member function that is distinguished from other member functions by having the same name as its class.
构造函数没有参数,并且返回的类型实例中的所有属性都为空。
The constructor function has no parameters and returns an instance of the type with all of its attributes set to null values.
请注意(虽然图中没有)组件必须返回正确的family类型。
Note (although it is not pictured) that the component must return the right family type.
应用推荐