I have a map with a left hand string arguement and a right hand class pointer.
When displaying the map how do I display the class objects instead of their memory location which is held?
Any help appreciated.
Thanks.
map <string,titles*> TitlesMap;
map <string,titles*>::iterator it;
// ===== display titles =====
titles::display()
{
// display header information
cout << "Library Information System" << "\n";
cout << "==========================" << "\n";
// list all titles
for (it=TitlesMap.begin();it != TitlesMap.end();++it)
{
cout << "Key = " << (*it).first;
cout << "Value = " << (*it) << endl; ?????????????
}
}
When displaying the map how do I display the class objects instead of their memory location which is held?
Any help appreciated.
Thanks.
map <string,titles*> TitlesMap;
map <string,titles*>::iterator it;
// ===== display titles =====
titles::display()
{
// display header information
cout << "Library Information System" << "\n";
cout << "==========================" << "\n";
// list all titles
for (it=TitlesMap.begin();it != TitlesMap.end();++it)
{
cout << "Key = " << (*it).first;
cout << "Value = " << (*it) << endl; ?????????????
}
}