static void Main(string[] args) { Person male = new Person(); Person female = new Person(); male.createPerson(25); female.createPerson(28); Console.WriteLine(male.ToString()); Console.WriteLine(female.ToString()); }
public void createPerson(int id) { Person newPerson = new Person(); newPerson.Age = id; if (id % 2 == 0) { this.Name = "Petur"; this.Gender = Gender.male; this.Age = id; } else { this.Name = "Maria"; this.Gender = Gender.female; this.Age = id; } }