How can I modify to make him calls the constructor? Textbooks code error is no
The class s {
Public:
S () {
* STR='\ 0'; Len=0;
}
S (char * PSTR)
{
Strcpy (STR, PSTR); Len=strlen (PSTR);
}
Char * gets () {
return str;
}
Int getLen ()
{
Return len.
}
S operator + obj (s);
Private:
Char STR [100].
Int len.
};
S s: : operator + obj (s)
{
Strcat (STR, obj. STR);
return str;
}
Int main ()
{
S obj1 (" Visual ");
S obj2 (" c + + ");
S obj3 (" language ");
Obj3=obj1 obj2 + + obj3;
Cout & lt; <"Obj3. STR=" & lt; Cout & lt; <"Obj3. Len=" & lt; }
CodePudding user response: