C++
[C++] 클래스 동적 배열 초기화
todoni
2022. 7. 19. 10:19
Zombie *zombie = new Zombie[N](name);
배열 할당할 때 초기화도 동시에 안되나 싶어서 저렇게 써봤더니
array 'new' cannot have initialization arguments
라는 에러 메시지가 뜬다. 안되는군..
그리고 new Zombie[N] 이렇게 할당하면 클래스 생성자가 N번 호출됨!