Match pseudocode chunks with types of DI used in them.
Example 1:
class Robot is
Legs legs = new Legs()
method walk() is
legs.walk()
class Control is
Robot bob = new Robot()
bob.walk()
Example 2:
class Robot is
Legs legs
constructor of Robot(Legs legs) is
this.legs = legs
method walk() is ...
class Control is
Robot bob = new Robot(new Legs())
bob.walk()
Example 3:
class Robot is
Legs legs
method setLegs(Legs legs) is
this.legs = legs
method walk()
legs.walk()
class Control is
Robot bob = new Robot()
bob.setLegs(new Legs())
bob.walk()
Example 4:
interface Robot is
method walk()
class BigRobot implements Robot is
method walk() is ...
class Control is
Robot bob
method controlRobot(Robot bob)
this.bob = bob
method walk() is
bob.walk()