Constructor injection implementation

Report a typo

The following piece of pseudocode implements constructor injection. Are there any errors in this piece of code?

class CarParts is
  Engine engine
  
  constructor of CarParts(Engine engine) is
    this.engine = engine
 
  method start() is
    engine.start()


class Car is
   CarParts car = new CarParts()
   car.start()
Select one or more options from the list
___

Create a free account to access the full topic