Let’s say I have a function in C++ that can return either a pointer to either an int, string, or double. What would be the return type for this function?
I would also like a variable that can store that return value once the function returns it. Should I just use the same type for that?
The only match is
void*.To use the value later, you will have to cast to
int*,string*ordouble*. So you need to keep track of the actual type in some way.