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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -