zoukankan      html  css  js  c++  java
  • 面向对象:接口

    namespace ConsoleApplication4
    {
        class dongwu
        {
            public void youyong()
            {
                Console.WriteLine("She was splendid like our flagship!");
            }
            public void quanji()
            {
                Console.WriteLine("But it's all in the past!");
            }
            public void tiaowu()
            {
                Console.WriteLine("Target Yamato!");
            }
        }
    }
    namespace ConsoleApplication4
    {
        class dog:dongwu,Interface1,Interface2
        {
            void Interface1.changge()
            {
                Console.WriteLine("She never gave up the hope even till the end!");
            }
            void Interface2.changge()
            {
                Console.WriteLine("Only the sea knows!");
            }
        }
    }
    namespace ConsoleApplication4
    {
        class Program
        {
            static void Main(string[] args)
            {
                dog data = new dog();
                Interface1 idata = new dog();//接口不能建立自己的实例,可以通过子类新建自己的实例
    
    
             
                dog data1 = new dog();
                Interface1 idata1 = data1;//接口可以实现基类的类型相互转换
                data1 = (dog)idata1;
    
    
    
                Interface1 idatai = new dog();//显示接口,接口中同名函数区分:子类中“Interface.方法名()”区分
                Interface2 idataii = new dog();
                idatai.changge();//显示接口的方法必须通过接口类型实例调用
                idataii.changge();
    
                idatai.tiaowu();//接口中同名函数不区分方法默认为所有接口中都是同一个方法
                idataii.tiaowu();
    
    
    
                Console.ReadLine();
    
            }
        }
    }
  • 相关阅读:
    监控Redis集群
    host主机监控规则
    Prometheus自身的监控告警规则
    Prometheus alerts 各种告警规则
    Elasticsearch官方文档离线访问实操指南
    Ceph 存储集群
    采用阿里云 yum的方式安装ceph
    设置HTTP请求自动跳转HTTPS
    jumpserver 2222端口的使用
    安装jumpserver 2.1.2版本遇到的坑
  • 原文地址:https://www.cnblogs.com/dlexia/p/4536059.html
Copyright © 2011-2022 走看看