-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclass.ts
More file actions
35 lines (28 loc) · 830 Bytes
/
class.ts
File metadata and controls
35 lines (28 loc) · 830 Bytes
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
class Department {
// name: string;
private employees: string[] = [];
constructor(private id: string, public name: string) {
// this.name = n;
}
describe(this: Department) {
console.log("Department: " + this.name);
}
addEmployee(employee: string) {
this.employees.push(employee);
}
printEmployeeInformation() {
console.log(this.employees.length);
console.log(this.employees);
}
}
const accounting = new Department("d1", "Accounting");
accounting.addEmployee("Max");
accounting.addEmployee("Manu");
// accounting.employees[2] = "Maria";
accounting.printEmployeeInformation();
// accounting.describe();
//
// const accountingCopy = { name: "test", describe: accounting.describe };
// accountingCopy.describe = accountingCopy.describe.bind(accounting);
//
// accountingCopy.describe();