コード例 #1
0
        static void Main(string[] args)
        {
            Ifactory  operFactory = new AddFactory();
            Operation oper        = operFactory.CreateOperation();

            oper.NumberA = 1;
            oper.NumberB = 2;
            double result = oper.GetResult();
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            IFactory factory = new AddFactory();

            Console.WriteLine("Add:" + factory.createOperator().getResult(3, 4));

            Console.WriteLine(":" + getResultWithType(2, "Add", 8));
            Console.WriteLine(":" + getResultWithType(10, "Sub", 1));
        }
コード例 #3
0
        static void Main(string[] args)
        {
            IFactory  factory = new AddFactory();
            Operation oper    = factory.CreateOperation();

            oper.NumberA = 1;
            oper.NumberB = 2;
            double result = oper.GetResult();

            Console.WriteLine(result);
            Console.ReadKey();
        }