zoukankan      html  css  js  c++  java
  • C# 接口


    using
    System; class testInterface { // class Bird { public void Run() { Console.WriteLine("鸟在奔跑!"); } } //接口 public interface IFlyable { //接口和抽象类一样,也是只能有方法的声明,不能有任何的实现 void Fly(); } //麻雀 class Sparrow : Bird, IFlyable { #region IFlyable 成员 public void Fly() { Console.WriteLine("小麻雀飞在树林中。"); } #endregion } //鹦鹉 class Parrot : Bird, IFlyable { #region IFlyable 成员 public void Fly() { Console.WriteLine("鹦鹉在小笼子里飞..."); } #endregion } //企鹅 class Penguin : Bird { } static void Main() { IFlyable fly = new Parrot(); fly.Fly(); } }

    Output:

    鹦鹉在小笼子里飞...

  • 相关阅读:
    KafKa 发消息到Storm
    HBase的优化
    HBase部署与使用
    Scala 类
    Scala高阶函数
    模式匹配
    Scala数据结构
    scala基础语法
    Scala安装配置
    Kafka工作流程分析
  • 原文地址:https://www.cnblogs.com/bluestorm/p/3397668.html
Copyright © 2011-2022 走看看