At LearnCpp.com | 1.10 — A first look at the preprocessor。下部首警卫,还有那些代码片断:C++中的标题警卫
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
约定或必做的事情?
谢谢。
那么,上面实现的头部gurad是否插入了“add.h”? – Simplicity 2011-01-22 09:47:54