Because if it’s not by reference, it’s by value. To do that you make a copy, and to do that you call the copy constructor. But to do that, we need to make a new value, so we call the copy constructor, and so on…
(You would have infinite recursion because “to make a copy, you need to make a copy”.)
Related Contents:
- The copy constructor and assignment operator
- What is a converting constructor in C++ ? What is it for?
- What does the explicit keyword mean?
- What is the copy-and-swap idiom?
- Do the parentheses after the type name make a difference with new?
- What are the rules for calling the base class constructor?
- Why do we not have a virtual constructor in C++?
- C++, copy set to vector
- C++ template constructor
- Default parameters with C++ constructors [closed]
- Creating an instance of class
- Is passing a C++ object into its own constructor legal?
- How can I initialize C++ object member variables in the constructor?
- How to use base class’s constructors and assignment operator in C++?
- What are practical uses of a protected constructor?
- What does a colon following a C++ constructor name do? [duplicate]
- Copy constructor and = operator overload in C++: is a common function possible?
- When do we have to use copy constructors?
- Has the new C++11 member initialization feature at declaration made initialization lists obsolete?
- In C++ can constructor and destructor be inline functions?
- What is a non-trivial constructor in C++?
- Can I use identical names for fields and constructor parameters?
- How to initialize a const field in constructor?
- C++ Constructor/Destructor inheritance
- C++: constructor initializer for arrays
- Why won’t this compile without a default constructor?
- Why do C++ objects have a default destructor?
- What is constructor inheritance?
- Dynamically allocating an array of objects
- Why use an initialization method instead of a constructor?
- C++ – initializing variables in header vs with constructor
- Select class constructor using enable_if
- Can I initialize an STL vector with 10 of the same integer in an initializer list?
- Infinite loop in constructor without for or while
- Avoiding copy of objects with the “return” statement
- How to copy a string of std::string type in C++?
- How many constructors does the class have?
- Cleanest way to copy a constant size array in c++11
- A most vexing parse error: constructor with no arguments
- What is the order of evaluation in a member initializer list?
- Why should I prefer to use member initializer lists?
- Defining an object without calling its constructor in C++
- Who deletes the memory allocated during a “new” operation which has exception in constructor?
- call to pure virtual function from base class constructor
- Why user-defined move-constructor disables the implicit copy-constructor?
- Do built-in types have default constructors?
- Why shared_from_this can’t be used in constructor from technical standpoint?
- Copying non null-terminated unsigned char array to std::string
- Defining constructor in header file vs. implementation (.cpp) file
- How to add constructors/destructors to an unnamed class?