您实际上会考虑更好的编码风格:在标题内声明函数/方法的参数名称,或仅在源文件中声明参数名称,因为可以同时执行这两种操作:如果您实际上只考虑在源文件中声明函数/方法的参数名称,那么您将如何声明默认值?
外标题:
//One.hpp
#ifndef ONE_HPP
#define ONE_HPP
namespace eins {
/** \brief description
*
* \param one represents ....
* \param two represents ....
*/
void function(int,int);
}
#endif
// One.cpp
#include "One.hpp"
eins::function(int one,int two) {
//Do stuff//
}
Run Code Online (Sandbox Code Playgroud)
内部标题:
//One.hpp
#ifndef ONE_HPP
#define ONE_HPP
namespace eins {
/** \brief description
*
* \param one represents ....
* \param two represents ....
*/
void function(int one,int two);
}
#endif
// One.cpp
#include "One.hpp"
eins::function(int one,int two) {
//Do stuff// …Run Code Online (Sandbox Code Playgroud)