//tstringm.cpp //test for operators '+' and '==' as members of class String #include "stringm.h" #include main() { String s1("System"); String s2("New"); String s3 = s1; String s4, s5; //member operators: left operand must be an object of class String //operator '==' assert(s1==s3); assert(s1=="System"); //operator '+' s4 = s1 + s2; s5 = s1 + "Works"; //making sure concatenation was OK assert(s4=="SystemNew"); assert(s5=="SystemWorks"); //this will not invoke member operators: left operand is not a String object //String s5 = "Failure" + s1; //assert("System" == s1); return 0; }