Question: I haven't done C++ in at least 7 years and am suddenly knee deep in a C++ project. I would like some guidance with the following:

I have a class called Animal, and I have 3 classes that inherit from Animal: Cat, Dog and Bird. I have created a list object and am using it to store type Animal.

This list can contain Cats Dogs and Birds, when I am iterating through this list of Animals, I would like to know the immediate type of each Animal (whether it's a Cat, Dog or Bird).

When I say `typeid(animal).name();` it gives me Animal, which is true, but I would like to know what kind of Animal.

Any ideas?? Should I use enums??

Answer: 
Needing to know a specific concrete object type is typically a design smell in C++ so I'm going to suggest that you don't attempt to do this.

Instead, create an abstract (pure virtual) interface within `Animal` that describes the functionality you want your animals to have. Then you can utilize dynamic dispatch to call that functionality without even needing to know the dynamic type of the object. You can always create private non-virtual helper functions within the child classes if needed.

Also note that you'll need to store the `Animal`s by (smart) pointer in your container rather than by value. If you store them by value they will all be sliced on insertion into the list, losing the dynamic type information.

And as @Marcin pointed out, using the visitor pattern for double dispatch might be a better approach if you really do need to call specific methods on specific child classes.
Without using special tricks to give your base class information about derived types, there is no way for it to know what subtype an instance is. The simplest way to do this is, as @Joachim Wuttke suggests, to create a virtual function forcing derived classes to implement a name() method.

However, if you want to get a little fancier, the curiously recurring template parttern [CRTP](http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern) offers a more elegant, if esoteric solution:

```
#include <typeinfo>
#include <string>
#include <iostream>

template <class T>
class Animal {
public:
    virtual ~Animal() {};  // a base class
    std::string name() {
        return typeid(T).name();
    }
};

class Cat: public Animal<Cat> {

};

class Dog: public Animal<Dog> {

};

int main( int argc, char* argv[] ){
    Cat c;
    Dog d;

    std::cout << c.name() << std::endl;
    std::cout << d.name() << std::endl;

}

```

result (g++):

```
3Cat
3Dog

```

result (vs2008):

```
class Cat
class Dog

```

Note that as others have said typeid's name mangling is platform/compiler dependent, so to go from the names above back to the class you have to implement a platform/compiler-dependent demangling routine. Not especially difficult, but it does take away from the elegance of the solution.