I am trying to teach some students that in the following case, you must follow the link, otherwise the objects will be copied.
note: they do not yet know about copy constructors, so if possible, I would not want to mention them in this example.
int sumOfSizes(CObject const & a, CObject const & b)
{
return a.getSize() + b.getSize();
}
Can someone help me with a real example where the amount is not as expected?
clamp source
share