foo.h 파일

#ifndef __FOO_H
#define __FOO_H

class Goo;            // 아래 Goo* goo 사용(컴파일시 오류를 없애기 위해) 했는데 이렇게 하는게 맞는지 모르겠습니다. ;;
                         // 이것의 정확한 의미도 알고 싶구요.         TC++PL에서 본것 같은데 책 내용이 많아서 어느 부분에서 봤는지 모르겠습니다.
class Foo
{
public:
        Foo() {};
        ~Foo() {};

private:
        Goo* goo;
        char str[10];
};

#include "Goo.h"                       // include를 아래서 하는 이유???        
                                              // 위에서 하면 foo.h 내용은 포함이 되지 않는데 그 이유 말고 다른 이유가 존재 합니까?
#endif




Goo.h 파일

#ifndef __GOO_H
#define __GOO_H

#include "Foo.h"



class Goo
{
public:
        Goo() {};
        ~Goo() {};


private:
        Foo* foo;
        char str[10];
};
#endif






test.cpp

#include "Foo.h"


void main()
{
        Foo fo;
        Goo go;
}