인수로받은이 포인터를 const로 선언하려고합니다.이 포인터를 매개 변수로 전달하는 방법을 const로 지정하는 방법
static void Class::func(const OtherClass *otherClass)
{
// use otherClass pointer to read, but not write to it.
}
는 다음과 같이 호출되는 :
void OtherClass::func()
{
Class::func(this);
}
내가 CONST가 OtherClass 포인터를 선언 해달라고하면이 사려고 컴파일되지 않습니다, 나는 그것을 변경할 수 있습니다.
감사합니다. 이 잘 컴파일
void Class::func(const OtherClass *otherClass)
{
// use otherClass pointer to read, but not write to it.
}
죄송합니다.이 질문에 대해 사과드립니다. 코드에 오류가 있습니다. 더 이상 대답 할 필요가 없습니다. – Tomas