Coming from Java
, I am used to doing this:
void setColor(String color) {
this.color = color;
}
However, I recently switched to C++
, and I see a lot of this instead:
void setColor(string c) {
color = c;
}
Why not this? Is this not recommended?
void setColor(string color) {
this->color = color;
}