这是我从指导中得到的。而且我仍然不确定我是否做对了。该指令不需要任何输出,也没有给出示例,所以我很难弄清楚它。希望有人可以帮忙。谢谢!
using System.IO;
using System.Linq;
using System.Collections.Generic;
namespace CSharp_Shell
{
public class User
{
private string user_id;
protected string user_password;
public User(string id, string pass)
{
this.user_id = id;
this.user_password = pass;
}
public bool verifyLogin(string id, string pass)
{
return Equals(this.user_id, this.user_password);
}
public void updatePassword(string newPassword)
{
this.user_password = newPassword;
}
}
public class Administrator : User
{
private string admin_name;
public Administrator(string name, string id, string pass) : base(id, pass)
{
this.admin_name = name;
}
public void upatePassword(string newPassword)
{
base.updatePassword(newPassword);
}
public void updateName(string name)
{
this.admin_name = name;
}
}
public static class Program
{
public static void Main()
{
}
}
}```
Sup,约书亚。基类中的基类中的updatePassword应该是抽象的。是意味着User类也应该是抽象的,派生类将覆盖updatePassword方法