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

C#中接口的继承

2015-04-20 10:46 155 查看
    C#中接口是可以继承的,要求实现接口的类,需要实现所有接口中定义的相关方法。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace interfaceheri
{
interface person
{
void disp();
}

interface student : person
{
void dispStu();
}

class stuManager : student
{
public void disp()
{
Console.WriteLine("I am a person");
}

public void dispStu()
{
Console.WriteLine("I am a student");
}
}

class Program
{
static void Main(string[] args)
{
stuManager st = new stuManager();

st.disp();
st.dispStu();

Console.ReadLine();

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