2020. 10. 1. 22:11, Developer
class Person{
public name:string;
private _age:number;
constructor(age:number){
this._age=age;
}
}
const person:Person = new Person(35);
person.name='mark';
//person.age=23; 불가
console.log(person);
'Developer' 카테고리의 다른 글
[typescript]class - class안에 생성자의 private 변수 (0) | 2020.10.01 |
---|---|
[typescript]class - protected (0) | 2020.10.01 |
[typescript]interface-indexibel 은 string과 number 만 가능 (0) | 2020.10.01 |
[typescript]interface-함수를 프로퍼티로 (0) | 2020.10.01 |
[typescript]interface-optional property (0) | 2020.10.01 |
Comments, Trackbacks