C++ pass by pointer, default declaration -
if in h file, there function:
void printdictionary(dict *dic, wordtype type=all){ } and in corresponding cpp file, there function:
void printdictionary(dict *dic, wordtype type){ } will there compilation error? or correct corresponding functions?
there's error since both have function body; you've defined same function twice, breaking 1 definition rule.
declare function in header
void printdictionary(dict *dic, wordtype type=all); ^ not {} and define in source file did.
the default arguments should go on declaration in header, since needed call function using them. can't go on definition, definition correct is.
Comments
Post a Comment