»ó¼ÓµÈ °³Ã¼·Î °¡µæ Âù º¤Å͸¦ »èÁ¦ÇÏ´Â ¹æ¹ý
class CShape { /* blah */ };
class CCircle:
public CShape { /* blah */ };
class CTriangle: public CShape { /* blah */
};
class CRectangle: CShape { /* blah */ };
template <class T>
void stlwipe(T
&t)
{
T::iterator i = t.begin();
for(;
i != t.end(); ++i) delete (*i);
t.clear();
}
void main(void)
{
std::vector<CShape
*> shapes;
shapes.push_back(new CCircle());
shapes.push_back(new
CTrialngle());
shapes.push_back(new CRectangle());
stlwipe(shapes);
}