static void Main(string[] args) { SuchDoge doge = new SuchDoge(); doge.Name = "Doge"; Person lis = new Person("Lis Larsen", new DateTime(1961, 11, 29)); lis.AddPet(doge); Person per = new Person("Per Larsen", new DateTime(day: 10, month: 9, year: 1958), Person.Sex.Male, 1.85, 95, lis); lis.Weight = 60; lis.Height = 1.7; Console.WriteLine(per); Console.WriteLine(lis); lis.WalkThePets(); lis.PetTalk(); Console.ReadLine(); }
public static string Title(Person p) { string prefix; if (p._gender == Sex.Male) { prefix = "Mr. "; } else if (p.Married) { prefix = "Mrs. "; } else prefix = "Ms. "; return prefix + p._name; }
public Person(string name, DateTime birthday, Sex gender, double height, double weight, Person partner) { this.Name = name; this.Birthday = birthday; this.Gender = gender; this.Height = height; this.Weight = weight; this.Partner = partner; this.Id = NEXT_ID++; }