C++程序设计(c++头文件)
Definition of a class
- In C++,separated .h and .cpp files are used to define one class
- class declaration(声明) and prototypes(原型) in that class are in the header file(.h)
All the bodies of these function are in the source file(.cpp).
include叫做编译预处理
示例1
a.h的代码
#ifndef A //如果没有定义宏,则定义这个宏
#define A
using namespace std;
void show(){
cout<<"hello world"<<endl;
}
#endif