I found this page: https://stackoverflow.com/a/16910876/1254725.
THe implemented factory of this page is able to create the "Car" object, but also all of its dependencies :
static class CarFactory
{
public ICar BuildCar()
{
Engine engine = new Engine();
SteeringWheel steeringWheel = new SteeringWheel();
Tires tires = new Tires();
ICar car = new RaceCar(engine, steeringWheel, tires);
return car;
}
}
What do you think about it?
Ben