【发布时间】:2020-10-06 00:27:51
【问题描述】:
我知道在 C++ 中我们可以毫无问题地拥有这两个构造函数。在 Dart 中,当我尝试编写两个构造函数时,它说“默认构造函数已定义”
class Human {
double height;
int age;
Human()
{
height = 0;
age = 0;
}
Human (double startingheight){ //The default constructor is already defined
height = startingheight;
}
}
【问题讨论】: