이름공간과 함수질문
글쓴이: ghoflvhxj / 작성시간: 수, 2018/07/18 - 8:04오전
/* myString.h */ namespace mystd { class String { private: ... public: int GetLength(); }; void test(); }
/* myString.cpp */ #include "myString.h" using namespace mystd; int String::GetLength() { return 1; } //void test() {} 인식할 수 없음 void mystd::test() {}
String 클래스 멤버함수를 정의할 때 String에 접근할 때는 mystd를 생략할 수 있었는데 일반 함수는 생략할 수 없더군요.
위와 같은 코드가 있을 때 헤더파일에서 void test(){} 정의를 인식할 수 없던데 왜 그런가요?
Forums:
댓글 달기