執行 ❯
獲取您自己的 C# 伺服器
×
更改方向
更改主題,深色/淺色
前往 Spaces
using System; namespace MyApplication { // Interface interface IAnimal { void animalSound(); // interface method (does not have a body) } // Pig "implements" the IAnimal interface class Pig : IAnimal { public void animalSound() { // The body of animalSound() is provided here Console.WriteLine("The pig says: wee wee"); } } class Program { static void Main(string[] args) { Pig myPig = new Pig(); // Create a Pig object myPig.animalSound(); } } }
豬說:哼哼