CppPrimer icon indicating copy to clipboard operation
CppPrimer copied to clipboard

Exercise 13.37

Open heturing opened this issue 5 years ago • 0 comments

Exercise information

Exercise 13.36

Add members to the Message class to insert or remove a given Folder* into folders. These members are analogous to Folder’s addMsg and remMsg operations.

Question or Bug

Current version only add/ remove the folder from the folder list of a message. But it did not add this message to the message list of the folder.

void addFldr(Folder* f) { folders.insert(f); }
void remFldr(Folder* f) { folders.erase(f); }

it should be change to

void addFldr(Folder* f) { folders.insert(f); f.addMsg(this);}
void remFldr(Folder* f) { folders.erase(f); f.addMsg(this);}

heturing avatar Jan 31 '21 12:01 heturing