hi all,
In the book "Programming Languages-Pragmatics" second edition by Michael l. Scott and Morgan Kaufmann, there is a sentence while explaining about copy constructor:
"In recognition of this intent, a single-argument constructor in C++ is called a copy constructor."
This is about the constructor of the form foo::foo(const foo& object);
I could understand about that constructor but couldn't understand the statement I have quoted above...I think we cannot state that every single-argument constructor is a copy constructor....If I'm wrong or I seems to be misunderstood the sentence...please help me....
Copy constructor: foo::foo(const foo& object);
Normal single argument constructor: foo:foo(int a);
Both are single argument constructors but only the first one is a copy constructor...
Thanks in advance....
challarao 0 Junior Poster in Training
NathanOliver 429 Veteran Poster Featured Poster
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster
challarao 0 Junior Poster in Training
mike_2000_17 2,669 21st Century Viking Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.