方法原型风格澄清

method prototype style clarification

本文关键字:风格 原型 方法      更新时间:2023-10-16

在声明方法原型时,如果参数是什么很明显,那么省略参数名称并只显示类型是可以接受的风格吗?示例:

bool setGender(char);
bool setRomance(int);
bool setName(string);

[..]

double determineGenderFit(DateProfile);
double determineRomanceFit(DateProfile);
double determineFinanceFit(DateProfile);

是的,从函数声明中删除参数名称是可以接受的。尽管包含名称会改善自文档条件,但您的名称反映了对象的实际使用情况。