• 简单工厂模式


    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;
           }
       }
    }
  • 相关阅读:
    使用eclipse创建maven+动态web的项目
    关于Maven项目build时出现No compiler is provided in this environment的处理
    spark日志输出
    spark并行度加载关系数据库
    【java记录】序列化拷贝
    客户端远程访问高可用(HA)hdfs
    spark算法
    算子的分类和 宽依赖算子、窄依赖算子
    单元测试junit使用
    spark1.x和spark2.x兼容Iterable和Iterator问题【未解决】
  • 原文地址:https://www.cnblogs.com/jianhongtang2016/p/7143398.html
Copyright © 2020-2023  润新知