• 카테고리

    질문 & 답변
  • 세부 분야

    프로그래밍 언어

  • 해결 여부

    해결됨

왜 Something(const Something& st_in)이 호출되나요?

22.08.25 19:20 작성 조회수 133

1

print(something); 이면 Something something이 Something st에 복사가 되는 거라서 마치 Something st = something처럼 초기화가 이루어지는 것으로 보이는데 왜 copy constructor가 실행이 되나요?

Something st = something은 곧 Something st{ something } 이고 생성자가 있으므로 Something st(something)처럼 copy constructor를 호출하는 것인가요?

답변 1

답변을 작성해보세요.

1

강민철님의 프로필

강민철

2022.08.26

Something st = something은 곧 Something st{ something } 이고 생성자가 있으므로 Something st(something)처럼 copy constructor를 호출하는 것인가요?

>> 이 말씀이 적절해 보입니다.