public SuperGreenEngineAdapter(SuperGreenEngine aSuperGreenEngine)
            : base(aSuperGreenEngine.EngineSize, false)
        {
            if (aSuperGreenEngine == null)
            {
                throw new ArgumentNullException(nameof(aSuperGreenEngine));
            }
            _SuperGreenEngine = aSuperGreenEngine;

            // Other stuff that may be necessary. For now, nothing else need be done.
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            IList <IEngine> engines = new List <IEngine>();

            engines.Add(new StandardEngine(1300));
            engines.Add(new StandardEngine(1600));
            engines.Add(new TurboEngine(2000));

            // "Adapt" the new engine type
            SuperGreenEngine greenEngine = new SuperGreenEngine(1200);

            engines.Add(new SuperGreenEngineAdapter(greenEngine));

            foreach (IEngine engine in engines)
            {
                Console.WriteLine(engine);
            }
            Console.Read();
        }
Ejemplo n.º 3
0
 public SuperGreenEngineAdapter(SuperGreenEngine greenEngine)
     : base(greenEngine.EngineSize, false)
 {
 }