2个/多个类_循环调用_出错信息

ZC: 暂时的解决方式:(1)、调用 其中一个类的父类(父类 和 子类 的声明 放在不同的.h文件里)

          (2)、用 void* 来代替

 

1、

  1.1、main.cpp

#include <stdio.h>
#include <windows.h>
#include "AA.h"

void main()
{
    AA *pA = new AA();
    printf("%08X\n", pA);
    system("pause");
}

  1.2、AA.h

#ifndef __AA__
#define __AA__

#include "BB.h"

class AA
{
    BB* FpB;
};

#endif//__AA__

  1.3、BB.cpp

#ifndef __BB__
#define __BB__

#include "AA.h"

class BB
{
    AA* FpA;
};

#endif//__BB__

2、重新生成解决方案,报错信息:

 

3、

4、

5、

 

posted @ 2017-01-13 16:49  CppSkill  阅读(242)  评论(0编辑  收藏  举报