Index: typescript/src/index.ts =================================================================== diff -u -rfa30bc920677c99798fd0d29670c4ad28f83c4c2 -r4e7a4498005f8e51d60fabd375b93ab017792989 --- typescript/src/index.ts (.../index.ts) (revision fa30bc920677c99798fd0d29670c4ad28f83c4c2) +++ typescript/src/index.ts (.../index.ts) (revision 4e7a4498005f8e51d60fabd375b93ab017792989) @@ -6,17 +6,16 @@ import CarImpl from "./standard/CarImpl"; import CarExtImpl from "./standard/CarExtImpl"; import ObjExtCarImpl from "./standard/ObjExtCarImpl"; +import Car from "./standard/Car"; //인터페이스로 객체 Person 을 만들어서 loop 돌리는 예제 let persons: IPerson[] = R.range(0, 5) .map((n: number) => new Person("이동민", 99)); console.log(persons); - testMakePerson(); - //object 타입으로 정확하게는 리터럴 객체 선언 /** * interface 인터페이스 이름 { @@ -79,15 +78,17 @@ } console.log("인터페이스 객체 -> " + user1.gender); console.log("물음표 -> " + user2.gender); -console.log("키벨류 사용 -> " + user3["1"]); +console.log("키벨류 사용 -> " + user3[2]); // ----- deep dive // 진짜 인터페이스 사용은 이런것이다. -const carImpl = new CarImpl(); +const carImpl:Car = new CarImpl(); console.log("<- CarImpl 사용 -> "); carImpl.start(); carImpl.stop(); +var test:Car = new CarImpl(); + // 인터페이스 확장 인스턴스 샘플 const carExtImpl = new CarExtImpl(); console.log("<- carExtImpl 사용 -> "); Index: typescript/src/standard/CarImpl.ts =================================================================== diff -u -rd4cc210eef3c63f46a7de2e7f2d96b3099520225 -r4e7a4498005f8e51d60fabd375b93ab017792989 --- typescript/src/standard/CarImpl.ts (.../CarImpl.ts) (revision d4cc210eef3c63f46a7de2e7f2d96b3099520225) +++ typescript/src/standard/CarImpl.ts (.../CarImpl.ts) (revision 4e7a4498005f8e51d60fabd375b93ab017792989) @@ -1,7 +1,8 @@ import Car from "./Car"; +import Kakao from "./Kakao"; //CarImpl 클래스 선언 -export default class CarImpl implements Car { +export default class CarImpl implements Car, Kakao { name = "K5"; color = "white"; start(){ @@ -11,4 +12,9 @@ stop(){ console.log("정차"); } + + message = "hi" + send() { + console.log("message send"); + } } \ No newline at end of file FishEye: Tag d2133460ec003f42375d401a6329c35714b65209 refers to a dead (removed) revision in file `typescript/src/standard/Kakao.ts'. FishEye: No comparison available. Pass `N' to diff? FishEye: Tag d2133460ec003f42375d401a6329c35714b65209 refers to a dead (removed) revision in file `typescript/src/standard/KakaoImpl.ts'. FishEye: No comparison available. Pass `N' to diff? Index: typescript/src/standard/ObjExtCarImpl.ts =================================================================== diff -u -rfa30bc920677c99798fd0d29670c4ad28f83c4c2 -r4e7a4498005f8e51d60fabd375b93ab017792989 --- typescript/src/standard/ObjExtCarImpl.ts (.../ObjExtCarImpl.ts) (revision fa30bc920677c99798fd0d29670c4ad28f83c4c2) +++ typescript/src/standard/ObjExtCarImpl.ts (.../ObjExtCarImpl.ts) (revision 4e7a4498005f8e51d60fabd375b93ab017792989) @@ -1,12 +1,20 @@ import CarExtImpl from "./CarExtImpl"; +import KakaoImpl from "./KakaoImpl"; +import CarExt from "./CarExt"; +interface Duck { + checkType: string +} + //ObjExtCarImpl 클래스 선언 -export default class ObjExtCarImpl extends CarExtImpl { +export default class ObjExtCarImpl extends CarExtImpl implements Duck{ constructor(name: string, color: string, car_name: string) { super(); this.name = name; this.color = color; this.car_name = car_name; } + + checkType = "check"; } \ No newline at end of file