[C++] 메소드 const 위치에 따른 의미

spring·2020년 11월 9일
0
const type class::foo(const type name) const;

왼쪽 부터 첫번째 const는 리턴타입을 상수화 하겠다는 뜻이다.

두번쩨 const는 파라매터를 상수화 하겠다는 뜻이다.

마지막 const는 멤버변수들을 건드리지 않겠다는 뜻이다.

profile
Researcher & Developer @ NAVER Corp | Designer @ HONGIK Univ.

0개의 댓글