cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
What is "src"
What is "src"
Jun 29, 2011 at 5:37pm UTC
joatmon
(157)
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 UTC
LB
(13399)
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 UTC
joatmon
(157)
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.