예제 #1
0
        private static void GetDecoratorPattern()
        {
            VehiculoBase v = new VehiculoBase();

            Console.WriteLine(v.GetDatosVehiculos());
            Camion cm = new Camion(v);

            Console.WriteLine(cm.GetDatosVehiculos());

            CamionConRemolque c = new CamionConRemolque(cm);

            c.Peso = 10000;
            Console.WriteLine(c.GetDatosVehiculos());
            CamionConRemolqueFrio cF = new CamionConRemolqueFrio(c);

            cF.Temperatura = 10;
            Console.WriteLine(cF.GetDatosVehiculos());
            Console.WriteLine(((CamionConRemolque)cF.VehiculoPadre).Peso);

            Console.WriteLine(cF.Temperatura);
        }