What is "src"

Jun 29, 2011 at 5:37pm
I'm studying an example of operators and references. In the code, there is a public constructor that has this syntax:

Point(const Point &src) {set(src.x, src.y);}

Can anybody explain to me what "src" is doing? Is this an abbreviation for "source"?

Thanks.
Jun 29, 2011 at 5:50pm
Yes, and it's just a simple parameter name. It could have been named APPLE_banana for all anyone cares, but src helps to suggest that, because this is a constructor, src will be used as the source for the new point being constructed.
Jun 29, 2011 at 6:09pm
Got it. I didn't realize that "src" was just a variable name chosen by the programmer. I was thinking that it was something more formal.

Thanks.
Topic archived. No new replies allowed.