C++ treats variables of user-defined types with value semantics. This means that objects are implicitly copied in various contexts, and we should understand what "copying an object" actually means.
Let us consider a simple example:
class person
{
std::string name;int age;public:
person(const std::string& name,int age): name(name), age(age){}};int main(){
person a("Bjarne Stroustrup",60);
person b(a);// What happens here?
b = a;// And here?}
(If you are puzzled by the name(name), age(age)
part, this is called a member initializer list.)