我正在創建一個構造函數,它需要從另一個類中獲取所有變量。目前我有:使用類中的靜態成員創建對象
public class Person
{
public Person(Address.AddressDetails newAddress , string newTitle, string newForname, string newSurname, string newTel,
string newMob, string newEmail)
{
}
static public int ID;
static public string Title;
static public string Decorations;
static public string Forename;
static public string Surname;
static public string Telephone;
static public string Mobile;
static public string Email;
static public Address.AddressDetails Address;
}
Address.AddressDetails中的變量都是靜態的。 我該如何讓Person.Address代表AddressDetails類中的所有變量?
的所有成員? – 2012-04-10 09:50:28
擁有所有這些靜態公共領域是非常糟糕的設計。他們將在所有「Person」實例中共享 - 這是什麼原因? – Oded 2012-04-10 09:50:58
從其他靜態字段複製也有點奇怪。 – 2012-04-10 09:51:42