const构造函数(常量构造函数)
class Point {
final num x;
final num y;
final num z;
//const Point(num x,num y,num z)这种方法不可以,
//必须是下面const Point(this.x,this.y,this.z)的方式
// const Point(num x,num y,num z) {
// // There's a better way to do this, stay tuned.
// this.x = x;
// this.y = y;
// this.z = z;
// }
const Point(this.x,this.y,this.z);
}
网友评论