50 lines
525 B
TypeScript
50 lines
525 B
TypeScript
class Bookkeeper implements Employee {
|
|
private identity: Identity;
|
|
private occupation: Occupation;
|
|
|
|
public constructor(name: string) {
|
|
this.identity = new Identity("bookkeeper", name);
|
|
this.occupation = new Calculating();
|
|
|
|
|
|
|
|
}
|
|
|
|
public introduce(): void {
|
|
this.identity.introduce();
|
|
}
|
|
public work(): void {
|
|
this.occupation.work();
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function makeBookkeeper(name: string): Employee {
|
|
return compose(
|
|
new Identity("smartly composed bookkeeper", name),
|
|
new Calculating()
|
|
);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|