【发布时间】:2020-05-22 16:22:55
【问题描述】:
我收到一条错误消息:
错误 CS7036 没有给出与 'Person.Person(string, int, string) 的所需形式参数 'email' 对应的参数,
我是新手,所以不确定,但感谢帮助,谢谢
编辑:它是在我的程序中以红色突出显示的“基础”
public class Student : Person
{
/// <summary>
/// student ID number
/// </summary>
private String Postcode; // student ID number
public Student() : base("(unknown name)", 0000)
{
Postcode = "(unknown ID)";
}
/// <summary>
/// Create a student with given name, year of birth and student ID
/// </summary>
/// <param name="name">name</param>
/// <param name="dateOfBirth">year of birth</param>
/// <param name="Postcode2">ID</param>
public Student(String name, int dateOfBirth, String Postcode2, string email) : base(name, dateOfBirth, email)
{
Postcode = Postcode2;
}
/// <summary>
/// read only poperty for ID
/// </summary>
public string PostalCode
{
get { return Postcode; }
}
/// <summary>
/// Return a string representation of this object.
/// </summary>
/// <returns>string representation of Student object</returns>
public override String ToString() // redefined from "Person"
{
return base.ToString() +
"Student Member\n" +
"Postcode: " + Postcode + "\n";
}
}
【问题讨论】:
-
我们需要查看您的
Person课程。 -
dateOfBirth由int表示而不是DateTime似乎很奇怪。
标签: c# visual-studio