So i have this:
class Grup : public Shape
{
private:
std::vector<Shape *> continut;
public:
static const std::string identifier;
Grup(){};
~Grup(){
continut.clear();
};
void add(Shape *);
void remove(Shape *);
void output(std::ostream &) const;
void readFrom(std::istream &);
void moveBy(int, int);
friend std::ostream &operator<<(std::ostream &, const Grup &);
}
and i want to implement the remove function. i tried this:
void Grup::remove(Shape *s)
{
vector<Shape*>::iterator it;
it = continut.begin();
while(it!=continut.end())
{
if((*it) == s)
{
it = continut.erase(it);
}
else it++;
}
}
but the == doesn't return me a true value. i also tried to overload the operator == on each shape but same result. what can i do?