C++ :: 소스파일, 헤더파일(*.h) 분리 예제
Edit C++ :: 소스파일, 헤더파일(*.h) 분리 예제 공부하고 있는 C++ 헤더 개념을 정리하는 글을 써보았습니다. 우선 파일 구조는 다음과 같습니다. hero.h // class Hero의 헤더 파일 hero.cpp // class Hero의 구체적 소스 코드 main.cpp // 메인 파일 hero.h #ifndef HERO_H #define HERO_H class Hero { string name; short HP; public: Hero(); Hero(string name, short HP); void info(); void set_info(string name, short HP); }; #endif 헤더 파일 맨 위에 #ifndef, #define, 그리고 마지막 줄에 #endif가 있습..