Original Post
I've noticed that when I declare a static member inside a class, it will be the same for all the child classes too so if I change it through a child class it will also change for all the others. What I'm trying to do is to somehow give a static id to each class type in a class hierarchy. For example, CLavrador derives from CDog which derives from CAnimal and CCat also derives from CAnimal. I want each one of them to have some integer so I can during runtime check it. If I have a CAnimal *p which points to a CDog and I write p->id it will be the static id of CDog. If virtual data members in a class were allowed, this would be also an easy task because each class would just redeclare the id variable and give it a value in the constructor. [Edited by - UriKiller on January 18, 2007 3:04:35 AM]