C++ 类中包含list类型对象时,类的指针无法对list对象进行赋值,直接用等号连接也不行,或者如图也是会报错,哪里有问题?
t->setNum(num);
报错的原因:setNum里的for循环写错了,应该改成for (iter = in.begin(); iter != in.end(); iter++)
t->num.assign(num.begin(), num.end());
报错的原因:t没有指向test类对象,应该把test* t;
改成test* t = new test();