zoukankan      html  css  js  c++  java
  • 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();
            }
        }
    }
  • 相关阅读:
    C# 设计模式-状态模式
    C# 设计模式-备忘录模式
    C# 设计模式-命令模式
    本地易优安装总结
    视频自动添加字幕
    百度商桥安装
    百度统计
    模板
    百度地图API
    栅格布局的理解
  • 原文地址:https://www.cnblogs.com/keiling/p/3651355.html
Copyright © 2011-2022 走看看