전처리기

    [c++] ifndef / endif

    #ifndef 에 대해서. garud coding에 대해서 본인은 아예 모르고 있었다. 전처리기를 사용해서 가드를 한다니.. 신기하다. ifndef와 endif는 보통 우리가 사용하는 header file에 포함되어 있어서 header file( ex. stdio.h, string.h 등)는 중복 선언해도 전처리기에서 중복해서 읽지 않는다. 사용하는 방법은 아래와 같다. test.h #ifndef _TEST_H_ #define _TEST_H class test { public: test(); ~test(); private: }; #endif test.cpp #include "test.h" #include test::test() { printf("헤더파일과 cpp파일은 이런 식으로~\n"); } test:..