Dependency Injection
Imagine that the example use previously was implemented differently:
public class BoundaryAlarm {
private GPS myGPS;
private DashLight myDashLight;
public BoundaryAlarm(){
myGPS = new GPSImpl();
myDashLight = new DashLightImpl();
}
public void CheckFieldLocation(){
// Implementation unchanged
}
}
The
↧