static void Main(string[] args) { var truck = new TruckFactory(); var ship = new ShipFactory(); truck.Deliver(); ship.Deliver(); }
static void Main(string[] args) { TransportFactory currentFactory; Transport currentTransport; currentFactory = new TruckFactory(); currentTransport = currentFactory.CreateTransport(); currentTransport.Deliver(); currentFactory = new ShipFactory(); currentTransport = currentFactory.CreateTransport(); currentTransport.Deliver(); currentFactory = new PlaneFactory(); currentTransport = currentFactory.CreateTransport(); currentTransport.Deliver(); }