class Person
{
public:
Person(const string& name, const Date& birthday, const Address& addr);
string name() const;
string birthDate() const;
string address() const;
...
private:
string theName; // 구현 세부사항
Date theBirthDate; // 구현 세부사항
Address theAddress; // 구현 세부사항
};
이러한 Person
클래스가 컴파일되기 위해서는 string
, Date
, Address
에 대한 정보를 알아야 한다.
#include <string>
#include "Date.h"
#include "Address.h"
때문에 Person.h
에는 이러한 include
코드가 필요하다.
그러나 이 include
문으로 인해 Person.h
와 위 세 헤더파일간의 컴파일 의존성이 생긴다.
결국 세 헤더파일 중 하나라도 바뀌거나 이들과 엮여있는 헤더파일이 변경되면, Person.h
도 다시 컴파일되어야 한다.
물론 Person.h
를 사용하는 다른 파일들까지 함께 컴파일되어야 한다.
이런 현상 때문에 파일 하나를 고쳤을 뿐인데 수많은 파일들이 몽땅 컴파일되고 링크되는 문제가 생기게 된다.
... 너무 길다 나중에 써야지