Why must the formal parameters of the copy constructor be set to a reference type?
Such as:
demo :: demo (const demo&object)
{
}
and
demo :: demo (const demo object)
{
}
Can't it work?
Because when the parameters are passed
If you adapt to passing objects instead of references, the combination of formal and actual parameters will use the copy constructor
Cause infinite recursion
Because a copy constructor is called when taking an object as a parameter, if the copy constructor takes an object as a parameter, it will call itself.