I would suggest that you write a member function for List called load(), perhaps takes a string or something. All it would do is, read the first line into the name, then keep reading entries into the vector of contacts until you hit the end of the file.
>>how to refer to the loaded list.
I don't see what's the problem here. Just have an object of the list, and create accessor functions and manipulating functions for it. Perhaps I'm misunderstanding you?
Code:
List l;
if(l.isLoaded() != true)
l.load("classlist.txt");
l.sort(BY_LASTNAME, SORT_DESCENDING);
Contact& c = l.find(BY_FIRSTNAME, "Chelsey");
std::cout << "Chelsey\'s last name is: " << c.lastName;
l.erase(&c);
l.studentAt(0).email = "[email protected]";
>>How can you create a variable, but let the user choose the identifier?
While this question has been asked before, I don't blame you for asking I'll give you a hint: the closest you'll get is probably by using a std::map. I'll leave the research to you though.
Hope this helps