A copy constructor is called when you initialize an object with an existing object and when the object is passed by value as a function parameter.
1 2 3 4 5 6 7
T a;
T b = a; //Copy construction.
T c(a); //Copy construction.
void f(T);
f(a); //Copy construction.
If you could define the copy constructor to accept an object by value, then you would be able to define a function that always recurses infinitely, since calling the copy constructor would require calling the copy constructor to construct the parameters for the copy constructor. It would be pointless to allow this.
Your post is not helpful a all, maybe if you can elaborate a little bit more what is in on your mind. I have read it , but i don't get why there would be an infinite recursion.
Book( Book orig) : author_(orig.author_), isbn_(orig.isbn_), price_(orig.price_), title_(orig.title_) {}
Book orig, ==> will call the default constructor or the 4- args constructor, so why would there be an infinite recursion ?
No the compiler will try to call the copy constructor because it needs to copy the class in order to pass the class by value. When you pass by reference you avoid the need to copy the class, instead you are passing a reference (the address) of an existing instance of your class.
and what is the problem with making a copy ? I mean I am just making a copy of a Book object , I am not invoking the copy constructor by any means ?
The copy constructor is for making copies. If you're making a copy of a Book to populate the argument for the copy constructor, the copy constructor will be invoked. And since that copy constructor invocation needs a copy of the object, the copy constructor will be invoked again, and so on and so forth.