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