클래스
class Student {
// field
name;
grade;
gender;
// contructor
constructor(name, grade, gender) {
this.name = name;
this.grade = greade;
this.gender = gender;
}
// method
study() {
console.log('공부')
}
introduce () {
console.log(`안녕하세요. ${this.name}`)
}
}
// instance 생성
let student = new Student("신봄", "A+", 'male);
student.study()타입스크립트의 클래스
접근제어자(Access Modifier)
private
protected
생성자
인터페이스와 클래스
Last updated