Well i have a little problem thats difficult for me to explain.
I want to do something like this. Basically i want to be able to pass multiple vectors of derived objects into a function that will process them all with the same functions from the abstract base.
CODE
vector<derived1> der1;
vector<derived2> der2;
...
next('A',der1);
next('B',der2);
...
void next(char c,vector</*SOMETHING?*/> &VAR)
{
abstractBase *ptr,*ptr2;
if (c=='A')
{
derived1 newd;
ptr=&newd;
}
if (c=='B')
{
derived2 newd;
ptr=&newd;
}
for (i=0;i<VAR.size();i++)
{
ptr2=&VAR[i];
check=ptr2->keep();
if(!check)
{
VAR.erase(i);
continue;
}
check=ptr2->double();
if(check)
{
VAR.push_back(newd);
}
...
...
So im basically wondering if i could put something in place of /*SOMETHING*/ or maybe do this with a template? Thanks for any help. Im basically assuming there is some way to do this otherwise i cant see any use for polymorphism, assuming thats what you call this.