add.h:
#include "mymath.h"
int add(int x, int y);
subtract.h:
#include "mymath.h"
int subtract(int x, int y);
main.cpp:
#include "add.h"
#include "subtract.h"
在实施头文件保护时,如下所述:
#ifndef ADD_H
#define ADD_H
// your declarations here
#endif
- 这里的声明应该是什么?而且,
int main()
应该放在#endif
之后吗? - 添加
_H
是一种约定还是必须要做的事情?