2016-01-11 13:49:12 +01:00
|
|
|
// Car without DI
|
2016-05-03 14:06:32 +02:00
|
|
|
import { Engine, Tires } from './car';
|
2016-01-11 13:49:12 +01:00
|
|
|
|
|
|
|
//#docregion car
|
|
|
|
export class Car {
|
|
|
|
|
|
|
|
//#docregion car-ctor
|
|
|
|
public engine: Engine;
|
|
|
|
public tires: Tires;
|
|
|
|
public description = 'No DI';
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
this.engine = new Engine();
|
|
|
|
this.tires = new Tires();
|
|
|
|
}
|
|
|
|
//#enddocregion car-ctor
|
|
|
|
|
|
|
|
// Method using the engine and tires
|
|
|
|
drive() {
|
|
|
|
return `${this.description} car with ` +
|
|
|
|
`${this.engine.cylinders} cylinders and ${this.tires.make} tires.`
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//#enddocregion car
|