If the objects are of the same type, return them in an array.
Functions cannot return an array.
You cannot return more than one type.
Actuallty, the only time you ever want top return a value is when you want your function to be usable as an RVAL. That is, it will be used on the right-side of an assignment operator:
-
int result = MyFunction();
-
Here MyFunction() needs to return an int.
In all other cases you do not use the return type.
For several types to be returned simulataneously, use output arguments. If the function has to create the object, then pass in the address of a pointer so the function can out the address of the newly created onject inside it. If the object already exists and the functions need to update it, then pass the object by reference.
This allows the return type to be a completion code that that caller can test to see what happened.