using System.Collections.Generic;
public static void Main()
Person peter = new Person() { Gender = "Male", Eyes = "Blue", HairColor = "Brown", Age = 40 };
Person lucy = new Person() { Gender = "Female", Eyes = "Green", HairColor = "Red", Age = 35 };
Person child = peter + lucy;
Console.WriteLine(child);
var peterBefore = peter.Age;
Console.WriteLine("Yesterday peter was " + peterBefore + " but today is his " + (peter.Age) + "th birthday");
public string Gender { get; set; }
public string Eyes { get; set; }
public string HairColor { get; set; }
public int Age { get; set; }
public Person(Person c1, Person c2)
Random rand = new Random();
List<string> genders = new List<string> { "Male", "Female" };
Gender = genders[rand.Next(genders.Count)];
List<string> eyes = new List<string> { c1.Eyes, c2.Eyes };
Eyes = eyes[rand.Next(eyes.Count)];
List<string> hairColors = new List<string> { c1.HairColor, c2.HairColor };
HairColor = hairColors[rand.Next(hairColors.Count)];
public override string ToString()
return "Gender: " + Gender + ", " + "Eyes: " + Eyes + ", " + "HairColor: " + HairColor;
public static Person operator +(Person c1, Person c2)
return new Person(c1, c2);
public static Person operator ++(Person p)