Пример #1
0
        public void TestMethod1()
        {
            IDriver driver = new Driver();
            ICar    acar   = new ACar();

            driver.ToDrive(acar);

            ICar bcar = new BCar();

            driver.ToDrive(bcar);
            //共5行
        }
Пример #2
0
        public void TestMethod2()
        {
            ICar     acar   = new ACar();
            IDriver2 driver = new Driver2(acar);

            driver.ToDrive();

            ICar     bcar    = new BCar();
            IDriver2 driver2 = new Driver2(bcar);

            driver2.ToDrive();
            //共6行代码
        }