1. 关于 include方面
    如果A类,B类都需要使用到共同的 tool.h中的函数
    C++构建工程要点
    #ifndef TOOL_H
    #define TOOL_H
    int addNum(int num);
    #endif // !TOOL_H
    增加一个base.h文件,把共用的头文件都放在base.h中
    C++构建工程要点

可以在B类的.h文件中引入 #include “base.h”
C++构建工程要点
在A类的.h 文件中引入 #include “B.h”
在main.cpp中引入 #include “A.h”
就可以使用tool.h工具的内容

相关文章:

  • 2021-09-20
  • 2021-11-11
  • 2021-09-21
  • 2022-12-23
  • 2021-05-08
  • 2021-07-22
  • 2021-04-02
  • 2021-08-14
猜你喜欢
  • 2021-09-12
  • 2021-07-19
  • 2022-12-23
  • 2021-05-20
  • 2021-10-04
  • 2022-01-01
  • 2022-12-23
相关资源
相似解决方案