接口Test
来源:互联网 发布:淘宝商品上架流程图 编辑:程序博客网 时间:2024/05/22 20:53
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace DemonInterfaceTest{ interface IEnglishDimensions { float Length(); float Width(); } interface IMetricDimensions { float Length(); float Width(); } class Box : IEnglishDimensions, IMetricDimensions { float lengthInches; float widthinches; public Box(float length, float width) { lengthInches = length; widthinches = width; } float IEnglishDimensions.Length() { return lengthInches; } float IEnglishDimensions.Width() { return widthinches; } float IMetricDimensions.Length() { return lengthInches * 2.54f; } float IMetricDimensions.Width() { return widthinches * 2.54f; } } class Program { static void Main(string[] args) { Box myBox = new Box(30.0f, 20.0f); IEnglishDimensions eDimensions = (IEnglishDimensions)myBox; IMetricDimensions mDimensions = (IMetricDimensions)myBox; Console.WriteLine("Length(in):{0}", eDimensions.Length()); Console.WriteLine("Width(in):{0}", eDimensions.Width()); Console.WriteLine("Length(cm):{0}", mDimensions.Length()); Console.WriteLine("Width(cm):{0}", mDimensions.Width()); } }}
输出结果:
Width(in):20
Length(cm):76.2
Width(cm):50.8
- 接口Test
- 数据接口test
- HttpClient测试接口Test
- WCF test client总结 测试服务端接口实现
- thinking in java test chapter9接口(1)~(10)
- test
- test
- test
- test
- test
- test
- test
- Test
- test
- Test
- test
- test
- test
- 嵌入式常用网站资源
- “扎金花FANS”进行了改进
- 一些感悟(二)
- windows中emacs+ slime+ sbcl 配置
- 使用ant生成可执行的jar包
- 接口Test
- centos 安装jdk、tomcat
- 利用反射来动态演示公共库中的自定义控件
- MyEclipse 8.6 properties editor
- 程序员究竟该如何提高效率
- 在Windows Server 系统中根据用户对文件夹设置访问权限设置的方法
- QTP--AOM自动化对象模型
- Emacs
- js回调函数(callback)