问题

A.h 文件

#include <b.h>

A.cpp

使用 B中函数

B.h

#include <A.h>

B.cpp

使用A中函数

解决方案

A.h 文件

去掉#include <b.h>
class B; // 前置声明

A.cpp

新增#include <B.h>
使用 B中函数

B.h

去掉 #include <A.h>
class A; // 前置声明

B.cpp

新增#include <A.h>
使用A中函数
posted on 2019-06-13 22:47  HDU李少帅  阅读(132)  评论(0编辑  收藏  举报