> struct ImageMngの上にclass G;追記し、実装部とヘッダー部を別ければよいと思う
あ、ソレのこと?
--- ImageMng.h ---
#ifndef IMAGEMNG_H__
#define IMAGEMNG_H__
class G;
struct ImageMng {
G* pG;
public:
void Init(G* pg) { pG = pg; }
void Func0() ;
};
#endif
--- ImageMng.cpp ---
#include <iostream>
#include "ImageMng.h"
#include "G.h"
void ImageMng::Func0() {
pG->Func1();
std::cout << pG->hoge << std::endl;
}
--- G.h ---
#ifndef G_H__
#define G_H__
#include <iostream>
#include "ImageMng.h"
class G {
public:
int hoge;
G() : hoge(7) { Image.Init(this); }
void Func1() { std::cout << "Func1" << std::endl; }
ImageMng Image;
};
#endif
--- main.cpp ---
#include "G.h"
int main() {
G g;
g.Image.Func0();
}
|