Look up inheritance and maybe even polymorphism.

Inheritance is when you set it so that one or more classes derive from another.
Polymorphism is some way to use the more generic class to control some behaviour of the more specific classes.

Suppose:

Code:
class Shape { };
class Square : public Shape { };
class Circle : public Shape { };

std::vector<Shape*> shape_list;
std::vector<Shape*>::iterator it;

for(it = shape_list.begin(); it != shape_list.end(); it++) {
    // do stuff with this shape
    Shape* p = NULL;
    if((p = dynamic_cast<Circle*>(*it)) != NULL) { }
    if((p = dynamic_cast<Square*>(*it)) != NULL) { }
}
I'm just not certain it really is dynamic_cast that is to be used in this case. I haven't used those kind of casts in a long time (dynamic/static/reinterpret/const_cast<>).