How to sort when there is a pointer array in class???

Here is the deal, we have to sort between classes when there is a string, int and a double pointer as private variables of the class.

I don't understand how to access the contents of the pointer array from the main function. I try to return it using a pointer return function in the class but it doesn't seem to work out well. I just don't understand how you are supposed to sort from the outside when you can't even retrieve the information from the array, there is only the set function available to put values into it but you can't possibly consider asking the user to input the values again after he has already given the information. How would you do it? I am trying to sort using the Selection Sort function.

Edit: Yes but the sorting function is supposed to be public though, as in out of the class.
Last edited on
Have the function be a member of the array. That way, the function has access to the array itself. Make the function public, and it can be accessed from main(), and thus sort the array. If you want to add values to the array, make a function that is public and in the class for doing so.
Topic archived. No new replies allowed.