C#----接口与多继承

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

namespace 接口
{
//Animal
    //Aquatic    水生动物
    //Land        陆地动物
   //Fly            会飞的
    public interface IRunable
    {
        void Run();
    }
    public interface ISwimable
    {
        void Siwm();
    }

    public interface IRunSwimable:ISwimable ,IRunable                        //接口的继承  一般不用 读起来有点不方便
    {
        void Change();
    }

    public class Animal
    {

    }

    public class Land:Animal ,IRunable                          //第一个必须是父类 后面才是接口 如果第一个不是父类 那么默认父类是Object
    {
        public void Run()
        {
            throw new NotImplementedException();
        }
    }
    public class Fly
    {
    }
    
    public class Aquatic
    {
    }

    public class leopards:IRunSwimable                                                                 //豹子
    {
        public void Change()
        {
            throw new NotImplementedException();
        }

        public void Siwm()
        {
            throw new NotImplementedException();
        }

        public void Run()
        {
            throw new NotImplementedException();
        }
    }
}
原文地址:https://www.cnblogs.com/keiling/p/3651355.html