Identical Class Member Names and Function Argument Names in C++ -
I have a simple object that holds some [public] data.
I want to keep my interface is clear, so I want to pre-edit / post-fix the names of the variables accessible from the publication nor the names of my function arguments.
He said, I did something like this:
template & lt; Typename T & gt; Structure fu {clear fu (t x): x (x) // This [i.e., x] is doing "right thing", but is it well defined? {/ * ^ No pre / post-fixing * /} T x; // no pre / post-fixing };
Just for repeat: All I'm asking is whether it is a well defined behavior, I should or should not do it ...
Thank you.
Yes, that's fine, and absolutely standard.
Local variables always come first in viewing a name, but the x (...)
clearly refers to only the member variable in an initial list [edit: or base category].
If you have not used the initial list, then you have to type:
clear fu (t x) {it-> X = x; }
Comments
Post a Comment