강의

멘토링

커뮤니티

Inflearn Community Q&A

No author

This post's author information has been deleted.

[MMORPG Game Development with C++ and Unreal Series] Part 1: Introduction to C++ Programming

Template Basics #1

안녕하세요 질문이있습니다

Written on

·

216

0

연산자 오버로딩 전역함수 버전에서, 

ostream& operator<<(ostream& os, const Knight& k)

{

os << k._hp;

return os;

}

 

여기서 인자를 const Knight& k로 하면되고,
const Knight* k로 하면 안되던데, 
&, * 둘다 주소값인데 왜 다른건가요? 

C++

Answer 1

0

Rookiss님의 프로필 이미지
Rookiss
Instructor

내부적으로는 동일하게 주소값이라고는 하나,
C++ 관점에서 포인터와 참조는 엄연히 다릅니다.

No author

This post's author information has been deleted.

Ask a question