Example #1
0
        static void Main(string[] args)
        {
            Llave llave1 = new Llave("abc");
            Llave llave2 = new Llave("def");
            Llave llave3 = new Llave("ghi");

            Automovil      automovil      = new Automovil("ghi");
            ProxyAutomovil proxyAutomovil = new ProxyAutomovil(automovil);

            Console.WriteLine($"\nSe usará la llave \"{llave1.codigo}\"");
            proxyAutomovil.ColocarLlave(llave1);
            proxyAutomovil.EncenderAutomovil();
            Console.WriteLine($"\nSe usará la llave \"{llave2.codigo}\"");
            proxyAutomovil.ColocarLlave(llave2);
            proxyAutomovil.EncenderAutomovil();
            Console.WriteLine($"\nSe usará la llave \"{llave3.codigo}\"");
            proxyAutomovil.ColocarLlave(llave3);
            proxyAutomovil.EncenderAutomovil();

            Console.ReadKey();
        }
 public ProxyAutomovil(Automovil automovil)
 {
     automovilReal = automovil;
 }