如果有了新的构造函数就不能调用默认的构造函数了
class Student
{
public Student(String str
) {
Console
.WriteLine(str
);
}
public Student() {
Console
.WriteLine("默认构造函数");
}
}
static void Main(string
[] args
)
{
Student stu
= new Student();
Student stu1
= new Student("新构造函数");
Console
.ReadKey();
}
转载请注明原文地址: https://yun.8miu.com/read-139973.html