#include <iostream>

using namespace std;

class Human {

bool civilized;

public:

Human() {

civilized = true;

}

void attack(Human & other) {

if(civilized) {

cout << "I can't attack!" << endl;

}

else {

cout << "kill you kill you!" << endl;

}

}

};

int main(void) {

Human human;

human.attack(human);

return 0;

}



C++로 시작하는 언리얼 4 게임 프로그래밍이란 책을 보고 따라하다보니 이런 예제가 나왔습니다.


void attack 함수의 인자값에 Human만 써도 Human & other과 다를게 없던데 & other을 왜 쓰는지 설명해주실 분 계신가요?