My question is without any copy constructor defined in the class,
how does the following statement works?
Here we are passing an object as argument
doesn't that mean we need a copy constructor(Call by ref)
A copy constructor will be created automatically if you don't declare one. It will just copy each member to the new object so s3.name and s2.name will both point to the same data. Probably not what you want.