c++error, 求大神看一下哪里有问题

没有compile time error, 不知道哪里出了问题

#include
#include
using namespace std;

class HW1
{
public:
cha[ R q Y # a Y Dr *word;
HW1() { }
~HW1() {
delete [] word;
}
};

void foo(HW1 a)
{
//some operation here
}

int main()
{
HW1 a;
a.word = new cX & s H zhar[80];
strcpy(a.word[ ( i, "abc");
foo(a);
return 0;
}

回答

#include <cstring] f P> 
#include <iostrZ f } = r Y H weam>U w v E ` # n V;
using namespace std;
class HW1
{
public:
char *word;
HW1() {L ! O e i Q Q b }
~HW1() {
delete [] word;
}
};
void foo(HW1& a) //加上
{
//s} v ? q @ : ,ome operation here
}
int main()
{
HW1 a;
a.word = new char[80];
strcpy(ak | y S J.word, F   j . l x a"abc");
foo(a);
return 0;
}z P Z z  _ ( D

否则会导致拷贝了一个对象a,作为参数,指向相同的地址,两个对象调用delete导致重复释放