Bri*_*ndy 17
有2个答案:
1)结合声明和定义:
class C
{
public:
//declaration and definition of f
void f()
{
}
};
Run Code Online (Sandbox Code Playgroud)
2)分离声明和定义:
class C
{
public:
//declaration of f
void f();
};
//definition of f
void C::f()
{
}
Run Code Online (Sandbox Code Playgroud)
通常在选项#2中,您将声明分隔为头文件和源文件中的定义.
| 归档时间: |
|
| 查看次数: |
2394 次 |
| 最近记录: |