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
·
221
0
연산자 오버로딩 전역함수 버전에서,
ostream& operator<<(ostream& os, const Knight& k)
{
os << k._hp;
return os;
}
여기서 인자를 const Knight& k로 하면되고,const Knight* k로 하면 안되던데, &, * 둘다 주소값인데 왜 다른건가요?
Answer 1
내부적으로는 동일하게 주소값이라고는 하나,C++ 관점에서 포인터와 참조는 엄연히 다릅니다.