resolving overloaded function
Posted on 2002-06-17
class derivedA : public base //etc
class derivedB : public base //etc
base* basePointerA = new derivedA;
base* basePointerB = new derivedB;
void aFunction(derivedA*); //how to call this?
I have an array of base*, which actually point to derived objects. I also have some functions that expect pointers to derived objects. Is there any way I can resolve the function to use based on the basePointerA and basePointerB in the example above?
I was hoping that simply calling
would put me into the body of aFunction(derivedA*), but this isn't the case. I'm on the verge of putting a virtual int getType() = 0;
function into the base class - what are my options?
Thanks for your help (+ apologies for wording the question awkwardly)