爲什麼問我重載運算符=? 我以前通過一個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