-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ts
50 lines (36 loc) · 1.27 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import {Man} from './src/man'
import {Woman} from './src/woman'
import {Delegate} from "./src/delegate"
// @ts-ignore
declare function require(name:string)
const process = require('process')
class World {
private delegate = new Delegate()
private natalia = new Woman(this.delegate, 'Natalia')
private sebastian = new Man(this.delegate, 'Sebastian')
private nicolas = new Man(this.delegate, 'Nicolas')
constructor() {
}
private getDate = () => {
let date = new Date().toLocaleString('en-US')
return date.substr(date.indexOf(' ')+1)
}
public communicate(){
process.stdout.write(this.getDate() + '\n')
this.sebastian.say('Hello my name is Sebastian')
process.stdout.write(this.getDate() + '\n')
this.natalia.say('Hello my name is Natalia')
process.stdout.write(this.getDate() + '\n')
this.sebastian.say('Are you free?')
process.stdout.write(this.getDate() + '\n')
this.natalia.say('No I have a boyfriend')
process.stdout.write(this.getDate() + '\n')
this.nicolas.say(':D Nope, she is alone... right now :D')
}
public printLogs(){
console.log(this.delegate.getDelegates())
}
}
const world = new World()
world.communicate()
world.printLogs()