该代码正在其中工作,couts
haha
但它会导致错误,因为它说:
Process returned -1073741819 <0xC0000005>
并弹出一个窗口,告诉我是否要发送错误消息。为什么是这样?
#include <iostream>
using namespace std;
template <class A>
A print( A a ) {
cout << a;
}
template <class T>
class David {
T a;
public:
David( T something ) : a( something ) {}
void laugh() {
print(a);
}
};
int main() {
David <string> Do("Hahaha");
Do.laugh();
}