本文整理汇总了C#中Dog.PrintSound方法的典型用法代码示例。如果您正苦于以下问题:C# Dog.PrintSound方法的具体用法?C# Dog.PrintSound怎么用?C# Dog.PrintSound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dog
的用法示例。
在下文中一共展示了Dog.PrintSound方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main()
{
Dog dogOne = new Dog("Sharo", "male", 7);
Dog dogTwo = new Dog("Sara", "female", 17);
Dog dogThree = new Dog("Tara", "female", 1);
Dog[] dogArr = new Dog[] { dogOne, dogTwo, dogThree };
Console.WriteLine("The average age of dogs is {0:F2} years old.", Animal.CalculateAverage(dogArr));
Console.WriteLine("Dog {0} says {1}.", dogThree.Name, dogThree.PrintSound());
Frog frogOne = new Frog("Skokla", "female", 23);
Frog frogTwo = new Frog("Handsome", "male", 9);
Frog frogThree = new Frog("Skokancho", "male", 2);
Frog[] frogArr = new Frog[] { frogOne, frogTwo, frogThree };
Console.WriteLine("The average age of frogs is {0:F2} years old.", Animal.CalculateAverage(frogArr));
Console.WriteLine("Frog {0} says {1}.", frogThree.Name, frogThree.PrintSound());
Kitten kittenOne = new Kitten("Hihi", 1);
Kitten kittenTwo = new Kitten("Kiki", 1);
Kitten kittenThree = new Kitten("Kenny", 2);
Kitten[] kittenArr = new Kitten[] { kittenOne, kittenTwo, kittenThree };
Console.WriteLine("The average age of kittens is {0:F2} years old.", Animal.CalculateAverage(kittenArr));
Console.WriteLine("Kitten {0} says {1}.", kittenThree.Name, kittenThree.PrintSound());
Tomcat tomcatOne = new Tomcat("Pancho", 4);
Tomcat tomcatTwo = new Tomcat("Robby", 3);
Tomcat tomcatThree = new Tomcat("Vasko", 8);
Tomcat[] tomcatArr = new Tomcat[] { tomcatOne, tomcatTwo, tomcatThree };
Console.WriteLine("The average age of tomcats is {0:F2} years old.", Animal.CalculateAverage(tomcatArr));
Console.WriteLine("Tomcat {0} says {1}.", tomcatThree.Name, tomcatThree.PrintSound());
}