Hi guys I'm just wondering why do we need to return a reference when overloading an operator such as =,I tried returning an object and it still worked but when I tried returning an object the copy constructor gets called after the operator= gets called but when I return a reference the copy constructor does not get called after it how come?
**note sorry about the bad naming I really should have named human animal but originally I was going to name humans but decided it would be easier with animals and seeing as I'm just revising naming conventions didn't seem important to me
> when I tried returning an object the copy constructor gets called
> but when I return a reference the copy constructor does not get called
> how come?
you tell it to make a copy and then you are surprise that it does do a copy.