Skip to content

Instantly share code, notes, and snippets.

@adrigm
Created April 8, 2013 11:39
void drawShapes(std::list<Shape*> shapes)
{
std::list<Shape*>::iterator pShape = shapes.begin();
std::list<Shape*>::iterator pEnd = shapes.end();
for ( ; pShape != pEnd; ++pShape)
{
switch (pShape->mType)
{
case CIRCLE:
// draw shape as a circle
break;
case RECTANGLE:
// draw shape as a rectangle
break;
case TRIANGLE:
// draw shape as a triangle
break;
//...
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment