c++ - How to implement unnamed parameters -
i have issue.
void setname(const string&); how can implement code above? need write this.name = ... there no named variable. there & symbol.
you don't need include explicit parameter names in function prototype. in fact, programmers deliberately omit them.
only when define function need supply parameter name, , if refer parameter.
so in header, void setname(const string&); fine. telling function takes reference string (the & denotes reference), , not return anything.
but when define function, you'll need supply parameter if refer it.
Comments
Post a Comment