class Person {
public static CITY = 'seoul';
public static hello() {
console.log('static 함수입니다.', Person.CITY);
}
public change() {
Person.CITY = 'Daegu';
}
}
// p 에서 CITY 의 내용을 바꾸면 P2 에서도 바뀐다. 서로 공유하는 값이다.
const p1 = new Person();
Person.hello(); // seoul
p1.change();
const p2 = new Person();
Person.hello(); // Daegu