static void Main(string[] args) { Dog[] dogs = new Dog[3]; //save dogs in array for (int i = 0; i < dogs.Length; i++) { dogs[i] = new Dog(); } //change the information of the dog in the first index dogs[0].Name = "Tuutikki"; dogs[0].Age = 1.5; dogs[0].Breed = "Japanese Spitz"; dogs[0].Color = "White"; dogs[0].Toys = 7; dogs[0].Owner = "Saara Virtanen"; //print dogs for (int i = 0; i < dogs.Length; i++) { dogs[i].PrintData(); } Dog dog2 = new Dog("Tessu", 3, "Samoyed"); //parametric constructor dog2.AddToy(); dog2.Color = "White"; dog2.Owner = "Kirsi Kernel"; dog2.PrintData(); }
static void Main(string[] args) { Dog dog = new Dog("Buddy"); dog.Breed = "golden retriever"; dog.Age = 9; dog.Owner = "Lily"; dog.Thirsty = true; dog.PrintData(); Dog edog = new Dog("Doge"); edog.Breed = "shiba inu"; edog.Age = 2; edog.Owner = "Rose"; edog.Hungry = true; edog.PrintData(); Console.WriteLine(dog.ToString()); Console.WriteLine(edog.ToString()); Console.ReadLine(); }