Ich erstelle einen Konstruktor, der alle Variablen aus einer anderen Klasse abrufen muss. Im Moment habe ich:Erstellen eines Objekts mit statischen Membern aus einer Klasse
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;
}
Die Variablen in der Address.AddressDetails sind alle auch statisch. Wie stelle ich Person.Address alle Variablen in der AddressDetails-Klasse dar?
Warum Sie mit einem regelmäßigen Konstruktor alle statischen Felder in Kombination sind zu vergeben? –
Mit all diesen statischen öffentlichen Feldern ist sehr schlechtes Design. Sie werden über alle Instanzen von 'Person' verteilt - was ist der Grund dafür? – Oded
Und das Kopieren von anderen statischen Feldern ist auch etwas komisch. –