手册目录
C# 教程
C#案例
要实现多个接口,请用逗号分隔它们:
interface IFirstInterface
{
void myMethod(); // 接口方法
}
interface ISecondInterface
{
void myOtherMethod(); // 接口方法
}
// 实现多个接口
class DemoClass : IFirstInterface, ISecondInterface
{
public void myMethod()
{
Console.WriteLine("Some text..");
}
public void myOtherMethod()
{
Console.WriteLine("Some other text...");
}
}
class Program
{
static void Main(string[] args)
{
DemoClass myObj = new DemoClass();
myObj.myMethod();
myObj.myOtherMethod();
}
}
相关视频
科技资讯
24小时阅读榜
1
2
3
4
5
6
7
8
9
10
精品课程
共5课时 | 17.4万人学习
共49课时 | 78.3万人学习
共29课时 | 62.6万人学习
共25课时 | 39.8万人学习
共43课时 | 73.9万人学习