two classes, two lists, one parameter

Hi to everyone,

i have to classes A and B and a list for every class :
list<A> Alpha;
list<B> Beta;

i make an iterator for each one
list<A>::iterator ait;
list<B>::iterator bit;
ait = A.begin();
bit = B.begin();

i want to call a function with parameter the iterator that i have above,
func(ait); and after func(bit);

how should i declare the parameter of function - func(list<?>::iterator X) to take the appropriate parameter, without need to make two functions????
can it happen??
or i have to make one function for each one iterator??
func(list<A>::iterator ait){}
and
func(list<B>::iterator bit){}

Are you asking about templates? http://cplusplus.com/doc/tutorial/templates/
yes you are right !!

Thank you!
Topic archived. No new replies allowed.