Examveda

What happens when objects s1 and s2 are added?
string s1 = "Hello";
string s2 = "World";
string s3 = (s1+s2).substr(5);

A. Error because s1+s2 will result into string and no string has substr() function

B. Segmentation fault as two string cannot be added in C++

C. The statements runs perfectly

D. Run-time error

Answer: Option C


Join The Discussion

Related Questions on Classes and Objects in C plus plus