Home > OS >  O bosses help under...
O bosses help under...

Time:10-19

Compilation occurs: stringOverload. Cc: the: for error: no match for 'operator<'(operand types are' STD: : ostream {aka STD: : basic_ostream & lt; Char> } 'and' void ')
cout

#include
#include
using namespace std;
The class String {
Public:
String (String STR)
: _str (STR)
{
cout<" Sting () "& lt; }

String operator=(const String & amp; Str2) {
Return a String (_str=str2. _str); }

Void the display () const {
cout<_str & lt; }
Private:
String _str;

};
Int main () {
String s1 (" hello ");
String s2 (" world ");
cout<" Before phrase "& lt; cout//coutS1=s2;
cout<" After overload "& lt; //cout//cout}
  • Related