-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeveloper.ts
44 lines (41 loc) · 889 Bytes
/
Developer.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
interface Work{
goForWork():void;
doWorking():void;
goOut():void;
}
class Worker2 implements Work{
//private name:string = "홍길동";
protected name:string = "홍길동";
//name:string = "홍길동";
/* constructor(name: string){
this.name = name;
} */
goForWork():void{
console.log(this.name+"출근 중");
}
doWorking():void{
console.log(this.name+"일 중");
}
goOut():void{
console.log(this.name+"퇴근 중");
}
}
class Developer extends Worker2{
doWorking():void this{
console.log(this.name+"개발 중");
}
}
class Corder extends Worker2{
doWorking():void{
console.log("코딩 중");
}
}
function doTest(w:Work){
w.goForWork();
w.doWorking();
w.goOut();
}
let dev:Work = new Developer();
doTest(dev);
let cod:Work = new Corder();
doTest(cod);