为什么要求我重载运算符 = ?我之前已经遍历了一个 std::list 并且我没有遇到这样的问题。
class Grup : public Shape {
private:
std::vector<Shape*> continut;
public:
static const std::string identifier;
Grup();
~Grup();
void add(Shape *shape);
void remove(Shape *shape);
void output(std::ostream &outs) const;
void readFrom(std::istream &ins);
void moveBy(int x, int y);
friend std::ostream &operator<<(std::ostream &outs, const Grup &grup);
};
std::ostream &operator<<(std::ostream &outs, const Grup &grup)
{
std::vector<Shape*>::iterator it;
outs << "Grupul este format din: " << std::endl;
for (it = continut.begin(); it != continut.end(); it++)
{
}
return outs;
}
错误:“没有可行的重载'='。”