为什么问我重载运算符=? 我以前通过一个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;
}
错误: “没有可行的超载 '='。”
请打印的代码,截图是不够明确以及如何'Grup'定义? – 2013-03-27 10:49:11