lundi 9 mars 2015

C++Type inspection

I have a c++ class:



Class farm {


...
protected:
vector<ff_node*> workers;
};

Class farm_withMoreWorkers: public farm {
void addWorker(){
ff_node *newWorker;

newWorker=new ff_node();// rather than adding ff_node make the instance type as that of type workers
farm:: workers.push_back(newWorker);
}
};


Is there a way to get the specific type of workers and create an instance of that type?!






Aucun commentaire:

Enregistrer un commentaire