What you are trying to do you need to use C++ Templates for.
Templates allow you to create functions that take any arbitrary data type and operate on them. For example you could have a sort function that takes ints, floats, chars, character string pointers, automobile classes, fishing hook classes, pointers to structures, etc.
See the cplusplus.com tutorial on templates...
http://www.cplusplus.com/doc/tutorial/tut5-1.html
botman