您的位置:首页 > 编程语言 > C#

c#实验5.5:接口的使用

2016-04-15 17:14 344 查看
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Student stu=new Student();
stu.eat();
stu.sleep();
Console.ReadKey();
}
}
public interface IPerson{void eat();void sleep();}
public class Student:IPerson
{
public void eat()
{
Console.WriteLine("去学生餐厅eat");
}
public void sleep()
{
Console.WriteLine("回学生公寓sleep");
}
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: