我有一个简短的问题。我有一个类Bank
需要具有不同数量的构造函数的属性。
class Program
{
static void Main(string[] args)
{
Bank ing = new Bank("ing");
int AccountNrName1 = ing.OpenAccount("Name", "LastName", "HouseNumber", "PostalCode");
int AccountNrName2 = ing.OpenAccount("Name", "LastName", "HouseNumber", "PostalCode", Balance, Minimum);
}
构造函数“OpenAccount”必须返回两种情况(AccountNrName1、AccountNrName2)。这是我到目前为止所拥有的:
public class Bank
{
private string name, lastname, housenumber, postalcode;
private int openaccount;
private int balance;
private int min;
public int OpenAccount(string Name, string LastName, string HouseNumber, string PostalCode, int Balance, int Min)
{
name = Name;
lastname = LastName;
housenumber = HouseNumber;
postalcode = PostalCode;
balance = Balance;
min = Min;
return openaccount;
}
}