请问这个程序错在哪?
#include"stdafx.h"
#include<iostream>
using namespace std;
class String
{
private:
string s1;
public:
String(string x)
{
s1 = x;
}
friend String operator+=( String& a1, String& a2)
{
return String (a1.s1 += a2.s1);
}
friend ostream& operator<<(ostream &os, String& a1)
{
os << a1.s1<< endl;
return os;
}
};
int main()
{
String m("software and");
String n("hardware");
m += n;
cout << m << endl;
return 0;
}
你放VB里执行,系统会提示哪里错了
没问题吧,用vs的编译器进行编译看下
热门标签: