I am having some problems with this function I am trying to write and could use a little help. I have an array of pointers to base class Person as.......Person* people[count] which is used to create and store objects of 3 derived classes. I am trying to figure out how I can remove all objects of a certain type from the array.
I have been trying something like the following but this does not work.
Code:for(i=0;i<count;i++) { if(typeid(*people[i])==typeid(Student)) { for(j=i;j<count-1;j++) people[j]=people[j+1]; count--; } }



LinkBack URL
About LinkBacks


