c#之接口练习
来源:互联网 发布:ubuntu 14.04 ant 编辑:程序博客网 时间:2024/06/04 23:37
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _接口练习
{
class Program
{
static void Main(string[] args)
{
//麻雀会飞 鹦鹉会飞 企鹅不会飞 飞机会飞
//多态实现
ifayable fly= new maque();//new yingwu();
fly.fly();
Console.ReadKey();
}
}
public abstract class animal
{
public double wings
{
get;
set;
}
public void chls()
{
Console.WriteLine("我会吃喝");
}
//public abstract void fly();抽象类
//public void fly
//{
// Console.WriteLine("会飞");
//}
}
public class maque:animal,ifayable
{
public void fly()
{
Console.WriteLine("我是麻雀我会飞");
}
}
public class yingwu : animal, ifayable,ispeakable
{
public void fly()
{
Console.WriteLine("我是鹦鹉我会飞");
}
public void ispeakable()
{
Console.WriteLine("鹦鹉还会说话");
}
}
public class feiji:ifayable
{
public void fly()
{
Console.WriteLine("飞机会飞");
}
}
public class qq : animal
{
}
public interface ifayable
{
void fly();
}
public interface ispeakable
{
void ispeakable();
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace _接口练习
{
class Program
{
static void Main(string[] args)
{
//麻雀会飞 鹦鹉会飞 企鹅不会飞 飞机会飞
//多态实现
ifayable fly= new maque();//new yingwu();
fly.fly();
Console.ReadKey();
}
}
public abstract class animal
{
public double wings
{
get;
set;
}
public void chls()
{
Console.WriteLine("我会吃喝");
}
//public abstract void fly();抽象类
//public void fly
//{
// Console.WriteLine("会飞");
//}
}
public class maque:animal,ifayable
{
public void fly()
{
Console.WriteLine("我是麻雀我会飞");
}
}
public class yingwu : animal, ifayable,ispeakable
{
public void fly()
{
Console.WriteLine("我是鹦鹉我会飞");
}
public void ispeakable()
{
Console.WriteLine("鹦鹉还会说话");
}
}
public class feiji:ifayable
{
public void fly()
{
Console.WriteLine("飞机会飞");
}
}
public class qq : animal
{
}
public interface ifayable
{
void fly();
}
public interface ispeakable
{
void ispeakable();
}
}
阅读全文
0 0
- c#之接口练习
- C#接口之接口定义
- C#学习之接口
- C#学习之接口
- C#学习之接口
- C#学习之接口
- C#之基础知识-----接口
- C#学习之接口
- C#学习之接口
- C#学习之接口
- C#学习之接口
- C#之接口(Interface)
- C#学习之接口
- C#学习之接口
- C#学习之接口
- C#学习之接口
- C#学习之接口
- C#学习之接口
- F5与CTRL+F5区别,浏览器缓存机制
- MySql,JABC基础整理笔记
- Android这可能是当今最火,功能最全的快速开发框架了
- laravel中如何区分get数据和post数据
- Linux工作队列实现机制
- c#之接口练习
- 计算机网络之动态主机配置协议DHCP
- _BSMachError: port 9f03; (os/kern) invalid name (0xf) "Unable to deallocate send right"
- 二分查找
- js进行字符串的字节判断和截取
- 笨方法学习Python-习题40: 字典, 可爱的字典
- Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #17: invalid drawable tag vec
- Android的内存管理
- 计算机网络之套接字SOCKET