C++ 오류좀 도와주세요..
가랑비
#includeiostream
#includevector
#includealgorithm
using namespace std;
class Shape{
protected:
virtual void draw()=0;
public:
void paint();
};
class Circle: public Shape{
protected:
virtual void draw();
};
class Rect: public Shape{
protected:
virtual void draw();
};
class Line: public Shape{
protected:
virtual void draw();
};
void Shape::paint(){
draw();
}
void Circle::draw(){
cout Circle endl;
}
void Rect::draw(){
cout Rectangle endl;
}
void Line::draw(){
cout Line endl;
}
void del(Shape*g) { delete g; }
int main(){
vectorShape* vg;
vg.push_back(new Shape());
vg.push_back(new Circle());
vg.push_back(new Rect());
vg.push_back(new Line());
vectorShape*::iterator it;
for(it=vg.begin(); it!=vg.end(); it++){
(*it)-draw();
}
for_each(vg.begin(), vg.end(), del);
}