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
|
|
|
|
2016-06-08 01:06:25 +02:00
|
|
|
// #docregion car
|
2016-01-11 13:49:12 +01:00
|
|
|
export class Car {
|
|
|
|
|
2016-06-08 01:06:25 +02:00
|
|
|
// #docregion car-ctor
|
2016-01-11 13:49:12 +01:00
|
|
|
public engine: Engine;
|
|
|
|
public tires: Tires;
|
|
|
|
public description = 'No DI';
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
this.engine = new Engine();
|
|
|
|
this.tires = new Tires();
|
|
|
|
}
|
2016-06-08 01:06:25 +02:00
|
|
|
// #enddocregion car-ctor
|
2016-01-11 13:49:12 +01:00
|
|
|
|
|
|
|
// Method using the engine and tires
|
|
|
|
drive() {
|
|
|
|
return `${this.description} car with ` +
|
2016-06-08 01:06:25 +02:00
|
|
|
`${this.engine.cylinders} cylinders and ${this.tires.make} tires.`;
|
2016-01-11 13:49:12 +01:00
|
|
|
}
|
|
|
|
}
|
2016-06-08 01:06:25 +02:00
|
|
|
// #enddocregion car
|