c#实验5.4:抽象类和重写
2016-04-15 16:56
483 查看
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { B b = new B(); b.add(10, 25); b.add(2.23, 5.54); b.add("i love", " you"); Console.ReadKey(); } } abstract class A { public abstract void add(int a, int b); } class B:A { public override void add(int a,int b) { Console.WriteLine("两个整数之和为:"+(a+b)); } public void add(double a,double b) { Console.WriteLine("两个整数之和为:"+(a+b)); } public void add(string a,string b) { Console.WriteLine("两个整数之和为:"+(a+b)); } } }
相关文章推荐
- c#连接SFTP上传文件
- C#编程基础 实验(6) (4-7)
- c#实验5.3:物体类的扩展
- c#中的delegate(委托)和event(事件)
- C#——关于属性字段中的set和get
- c#实验5.2:物体类
- c#中sealed修饰符
- .net c# 服务器共享文件夹 windows远程登陆 代码
- c# winform实现dll加载时注册
- c#弱事件(weak event)
- C#获取当前user的documents目录
- C#:OleDbDataAdapter 进行增,删,改,查操作
- C#Windows服务
- C# Random生成多个不重复的随机数万能接口
- C# 获取月份、周、操作时间
- C#中CopyTo()和Clone()的区别
- C#抽象类与接口的区别
- C# 数据类型和字节长度
- 详解C#中的反射
- C#标识符的命名规则