2020. 10. 1. 22:40, Developer
class Person{
private _age:number;
constructor(private _name:string, age:number){
this._name=_name;
this._age=age;
}
hello():void {
console.log(this._name);
}
}
const person : Person = new Person('kim',30);
person.hello();
'Developer' 카테고리의 다른 글
[typescript]class - getter와 setter (0) | 2020.10.01 |
---|---|
[typescript]class - 자식 생성자는 super를 꼭 가져야함 (0) | 2020.10.01 |
[typescript]class - protected (0) | 2020.10.01 |
[typescript]class - private (0) | 2020.10.01 |
[typescript]interface-indexibel 은 string과 number 만 가능 (0) | 2020.10.01 |
Comments, Trackbacks