本文翻译自:Where to put default parameter value in C++? [duplicate]
This question already has an answer here: 这个问题已经在这里有了答案:
- Default value of function parameter 4 answers 功能参数 4的 默认值
What's the place for the default parameter value? 默认参数值在哪里? Just in function definition, or declaration, or both places? 只是在函数定义或声明中,还是在两个地方?
#1楼
参考:https://stackoom.com/question/kVZx/在C-中将默认参数值放在哪里-重复
#2楼
Although this is an "old" thread, I still would like to add the following to it: 尽管这是一个“旧”线程,但我仍然想在其中添加以下内容:
I've experienced the next case: 我遇到了下一种情况:
- In the header file of a class, I had 在类的头文件中,我有
int SetI2cSlaveAddress( UCHAR addr, bool force );
- In the source file of that class, I had 在该类的源文件中,我有