Ejemplo n.º 1
0
        static void print_02()
        {
            Car       car       = new Car();
            Plane     plane     = new Plane();
            FlyingCar flyingcar = new FlyingCar();

            car.Run();
            plane.Fly();
            flyingcar.Run();
            flyingcar.Fly();
        }
Ejemplo n.º 2
0
        public void ISPRightWayTest()
        {
            ITerrainableVehicle terrainableVehicle = new Car();

            terrainableVehicle.Drive();
            IFlightableVehicle flightableVehicle = new Airplane();

            flightableVehicle.Fly();
            IVersatileVehicle versatileVehicle = new FlyingCar();

            versatileVehicle.Drive();
            versatileVehicle.Fly();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            FlyingCar clsCar = new FlyingCar();

            clsCar.Fly();
            clsCar.Run();

            IRunnable iRunable = clsCar as IRunnable;

            iRunable.Run();

            IFlyable iFlyable = clsCar as IFlyable;

            iFlyable.Fly();
        }
Ejemplo n.º 4
0
    static void Main(string[] args)
    {
        FlyingCar car = new FlyingCar();

        car.Run();
        car.Fly();

        IRunnable runnable = car as IRunnable;

        runnable.Run();

        IFlyable flyable = car as IFlyable;

        flyable.Fly();
    }
Ejemplo n.º 5
0
        public void testFutures2()
        {
            ICsConfigurationBuilder cb = TangFactory.GetTang().NewConfigurationBuilder();
            IInjector i  = TangFactory.GetTang().NewInjector(cb.Build());
            IInjector i2 = i.ForkInjector(new IConfiguration[] { });

            FlyingCar c = (FlyingCar)i.GetInstance(typeof(FlyingCar));

            Assert.IsTrue(c == c.getDriver().getMyCar());
            Assert.IsTrue(c.getDriver() == c.getDriver().getMyCar().getDriver());

            FlyingCar c2 = (FlyingCar)i2.GetInstance(typeof(FlyingCar));

            Assert.IsTrue(c2 == c2.getDriver().getMyCar());
            Assert.IsTrue(c2.getDriver() == c2.getDriver().getMyCar().getDriver());

            Assert.IsTrue(c2 != c.getDriver().getMyCar());
            Assert.IsTrue(c2.getDriver() != c.getDriver().getMyCar().getDriver());
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            FlyingCar car = new FlyingCar();

            car.Run();
            car.Fly();

            IRunnable runnable = car as IRunnable;

            runnable.Run();

            IFlyable flyable = car as IFlyable;

            flyable.Fly();

            car.Company    = "Naver";
            car.HorsePower = 12.4f;
            car.Year       = 1234;
            WriteLine($"{car.Company} {car.HorsePower} {car.Year}");
        }
Ejemplo n.º 7
0
            public override FlyingCar getMyCar()
            {
                FlyingCar c = fCar.Get();

                return(c);
            }
Ejemplo n.º 8
0
            public virtual FlyingCar getMyCar()
            {
                FlyingCar c = fcar.Get();

                return(c);
            }