There are 4 options.
The simplest option is to change the return type of show and uncomment your return, however this will be returning the map by value which will involve a copy and could (depending upon size) be very inefficient (possibly dangerous, depending upon LineDatabase's copy operator).
LineDatabase show()
{
LineDatabase Entry;
// .... ommited
return Entry;
}
The 2nd option is to do as was suggested by user258808 and create a new object then return it by pointer, the issue with this approach is that your client would have to know to call delete on this pointer when finished otherwise you would be creating a leak.
The 3rd option is to have Entry as a field of ReadMap and then return a reference. This is my personal preference as it imposes the least burden on the client, however it may also require you to 'reset' the Entry before each new run.
Something like this
class ReadMap
{
string fileName;
LineDatabase Entry;
public:
//constructors and destructor
ReadMap(){fileName="blank.txt";}
ReadMap(string name){fileName=name;}
~ReadMap(){}
//Function to print out visible list
LineDatabase& show()
{
int LineNumber=100;
string buffer;
ifstream myfile (fileName.c_str() );
while (myfile.good())
{
myfile >> LineNumber >> ws;
getline (myfile, buffer);
Entry.insert(pair<int, string>(LineNumber, buffer));
cout <<buffer << endl;
}
return Entry;
}
};
The issue with this is that it exposes your internal state to modification, it is possible to return a const reference but then the client cannot modify the Map.
Finally, you could do as was suggested by bodes. However this requires that the client passes in a Map for you to work on.
Your choice will depend on how much work you would like to require your client to do as well as what kind of constraints you need and/or do not need to place on the data structure.