多接口继承11111。。。。。。。。。。。。。。。。

来源:百度知道 编辑:UC知道 时间:2024/06/30 20:32:47
using System;

interface a
{ }
interface b
{ }
interface c : a, b
{ }
class k : c
{
public void x()
{
Console.WriteLine("hello");
}
}
class s
{
static void Main()
{
k i = new k();
i.x();
}
}

i.x();是调用k.x()方法

你的代码没有意义,因为a,b,c3人接口没有任何方法

你把x()方法定义在c接口内

static void Main()
{
c method = new k();
method.x();
}
感受下多态