コード例 #1
0
        static void DerivedInterface()
        {
            WriteLine("\nDerivedInterface()");

            IFormattableLogger logger = new ConsoleLogger2();

            logger.WriteLog("The world is not flat");
            logger.WriteLog("{0} + {1} = {2}", 1, 1, 2);
        }
コード例 #2
0
        static void ch8() // interface
        {
            WriteLine("FileLogger Start");
            ClimateMonitor monitor = new ClimateMonitor(new FileLogger("C:/temp/MyLog.txt"));

            monitor.strat();

            WriteLine("ConsoleLogger Start");
            ClimateMonitor monitor2 = new ClimateMonitor(new ConsoleLogger());

            monitor2.strat();

            IFormattableLogger logger = new ConsoleLogger2();

            logger.WriteLog("The world is not flat");
            logger.WriteLog("{0} + {1} = {2}", 1, 1, 2);
        }