C# 中的继承 "must declare a body because it is not marked abstract, extern, or partial"
inheritance in C# "must declare a body because it is not marked abstract, extern, or partial"
我试图使用 class Account
作为父对象,使用 class Login
作为子对象。
这里是 Account
代码看起来像
class Account
{
private string account;
private string password;
private string Email;
public Account();
public Account(string _account, string _password, string _Email)
{
this.setAcount(_account).setPassword(_password).setEmail(_Email);
}
.......
}
这里是 Class Login
class Login : Account
{
private bool login_status ;
private static int try_count ;
public Login()
{
login_status = false;
try_count = 0;
}
......
}
但是弹出错误信息
error1 'team2.Account.Account()' must declare a body because it is not
marked abstract, extern, or partial
这不是有效的声明:
public Account();
构造函数必须有主体:
public Account() { };
我试图使用 class Account
作为父对象,使用 class Login
作为子对象。
这里是 Account
代码看起来像
class Account
{
private string account;
private string password;
private string Email;
public Account();
public Account(string _account, string _password, string _Email)
{
this.setAcount(_account).setPassword(_password).setEmail(_Email);
}
.......
}
这里是 Class Login
class Login : Account
{
private bool login_status ;
private static int try_count ;
public Login()
{
login_status = false;
try_count = 0;
}
......
}
但是弹出错误信息
error1 'team2.Account.Account()' must declare a body because it is not marked abstract, extern, or partial
这不是有效的声明:
public Account();
构造函数必须有主体:
public Account() { };