zoukankan      html  css  js  c++  java
  • 简单工厂模式

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace 简单工厂模式
    {
       public class OperationFactory
       {
           public static Operation craateOperation(string operate)
           {
               Operation oper = null;
               switch (operate)
               {
                   case "+":
                       oper = new OpertionAdd();
                       break;
                   case "-":
                       oper = new OpertionSub();
                       break;
                   case "*":
                       oper = new OpertionMul();
                       break;
                   case "/":
                       oper = new OpertionDiv();
                       break;   
               }
               return oper;
           }
       }
    }
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace 简单工厂模式
    {
       public class Operation
       {
           private double _numberA = 0;
           private double _numberB = 0;
    public double NumberA
           {
               get { return _numberA; }
               set { _numberA = value; }
           }
           public double NumberB
           {
               get { return _numberB; }
               set { _numberB = value; }
           }
    
           public virtual double GetResult()
           {
               double result = 0;
               return result;
           }
       }
    }
  • 相关阅读:
    System.Net.Http.HttpClient POST 未能创建 SSL/TLS 安全通道
    SQL Server用户权限查询
    IIS 7 Deploy .Net Framework 4.8 Application
    System.Net.Http.HttpClient 模拟登录并抓取弹窗数据
    HtmlAgilityPack Sample
    嵌套 struct & class 的遍历
    SQL循环插入测试数据
    windows文本转语音 通过java 调用python 生成exe可执行文件一条龙
    Centos8 删除了yum.repos.d 下面的文件
    nacos 配置
  • 原文地址:https://www.cnblogs.com/jianhongtang2016/p/7143398.html
Copyright © 2011-2022 走看看