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. }
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(); }
public SuperGreenEngineAdapter(SuperGreenEngine greenEngine) : base(greenEngine.EngineSize, false) { }