D
developer28
Hi,
I would like to know the following.
suppose i write.
string str1 = "TestString";
string str2;
str2 = str1
Now can someone tell me how this assignment operator works internally.
actually i do something like
const char * temp = str1.c_str();
that converts it to a c type string.
and then when i modify the contents of temp, it also affects str2.
Now this makes me doubtful about the fact that internally both the
objects are using the same pointer.
Please forgive me if my query is too trivial.
Thanks for any help.
Regards,
Aman.
I would like to know the following.
suppose i write.
string str1 = "TestString";
string str2;
str2 = str1
Now can someone tell me how this assignment operator works internally.
actually i do something like
const char * temp = str1.c_str();
that converts it to a c type string.
and then when i modify the contents of temp, it also affects str2.
Now this makes me doubtful about the fact that internally both the
objects are using the same pointer.
Please forgive me if my query is too trivial.
Thanks for any help.
Regards,
Aman.