1 Star 0 Fork 50

陌./C_sharp面向对象笔记

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Operation.cs 1.06 KB
一键复制 编辑 原始数据 按行查看 历史
刘涛 提交于 2022-04-25 17:29 +08:00 . 笔记
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApp1
{
class Operation
{
// 将加减乘除四则运算看作一种操作,请设计操作抽象类Operation,
//该抽象类有一个Op的方法计算两个整数相应运算,并返回计算结果。
//并派生出四则运算操作类。计算器一个方法Do方法
public virtual double op(double a,double b) {
return 0;
}
}
class jia:Operation {
public override double op(double a, double b)
{
return a+b;
}
}
class jian : Operation
{
public override double op(double a, double b)
{
return a - b;
}
}
class c : Operation
{
public override double op(double a, double b)
{
return a * b;
}
}
class chu : Operation
{
public override double op(double a, double b)
{
return a / b;
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/chen-li-xing/c-sharp-object-oriented-notes.git
git@gitee.com:chen-li-xing/c-sharp-object-oriented-notes.git
chen-li-xing
c-sharp-object-oriented-notes
C_sharp面向对象笔记
master

搜索帮助