I'm getting this error:
Game.cpp:416: error: passing ‘const Coach’ as ‘this’ argument of ‘const std::string Person::getName()’ discards qualifiershome is a pointer, getCoach() returns a const Coach* const, and getName() returns a const string.Code:ticpp::Element Game::toXML() const { Team* home=homeTeam; Team* away=awayTeam; ticpp::Element game=("Game"); game.SetAttribute("location",location); //Home Team Elements ticpp::Element homeTeamElement("HomeTeam"); ticpp::Element homeCoach=("Coach"); //Coach Elements //Coach Attributes //ERROR IS HERE homeCoach.SetAttribute("name", (home->getCoach())->getName()); homeTeamElement.InsertEndChild(homeCoach);
If I remove all the consts, it works fine, but I need the consts.
Any help would be great.



LinkBack URL
About LinkBacks



