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: 
Since the list can contain any type of animal I am going to assume that it is a list of pointers. [In such case typeid will consider the most derived type of the object if you pass it the dereferenced pointer.](http://www.cplusplus.com/reference/typeinfo/type_info/)

```
typeid(*animal).name();

```

Is what you are looking for.
Implement a function name() in each subclass.