// 생성자 미 구현과 property 를 나중에 초기화 하는 방법
class Person {
  name: string = 'Malza';
  // 나중에 의도적으로 할당해 주겠다.
  age!: number;

  // 현재 생성자가 없지만 default 생성자가 있다.
  // 인자 없이도 실행될 수 있게 한다.

  //생성자를 구현한다면 이제 default 생성자는 사라진다.
  // constructor(age: number) {}
}

const p1: Person = new Person();
// 주의 하자. 까먹고 값 안 넣어주면 의도하지 않은 값이 나올 것이다.
p1.age = 29;
console.log(p1);
// default 생성자와 직접 만든 생성자를 모두 지원하는 방법.
// overriding 이 있지만
class Person {
  name: string = 'Malza';
  age?: number;

  constructor(age?: number) {
    if (age === undefined) this.age = 20;
    else this.age = age;
  }
}

const p1: Person = new Person();
const p2: Person = new Person(29);
console.log(p1);
console.log(p2);
constructor 앞에 async 를 붙일 수 없다.