2020. 10. 2. 11:17, Developer
class Person<T, K>{
private _name:T;
private _age:K;
constructor(name:T,age:K){
this._name=name;
this._age=age;
}
}
new Person('kim',30); <- 여기서 객체의 타입을 정해버림
'Developer' 카테고리의 다른 글
[typescript]Decorator - 기본 (0) | 2020.10.02 |
---|---|
[typescript]Generic type 응용 (0) | 2020.10.02 |
[typescript]Generic type - 상속 (0) | 2020.10.02 |
[typescript]Generic class (0) | 2020.10.02 |
[typescript]Generic (0) | 2020.10.02 |
Comments, Trackbacks