2020. 10. 1. 22:52, Developer
class Person{
constructor(protected _name:string, protected _age:number){
}
hello():void {
console.log(this._name);
}
}
const person : Person = new Person('kim',30);
person.hello();
class Child extends Person{
constructor(){
super('man',300);
}
}
const child:Child = new Child();
child.hello();
'Developer' 카테고리의 다른 글
[typescript]class - readonly (0) | 2020.10.01 |
---|---|
[typescript]class - getter와 setter (0) | 2020.10.01 |
[typescript]class - class안에 생성자의 private 변수 (0) | 2020.10.01 |
[typescript]class - protected (0) | 2020.10.01 |
[typescript]class - private (0) | 2020.10.01 |
Comments, Trackbacks