The save and remove Members
Aside from copy control, the Message class has only two public members: save, which puts the Message in the given Folder, and remove, which takes it out:
void Message::save(Folder &f){ folders.insert(&f); // add the given Folder to our list of Folders f.addMsg(this); // add this Message to f's set of Messages}void Message::remove(Folder &f){ folders.erase(&f); // take the given Folder out of our list of Folders f.remMsg(this); // remove this Message to f's set of Messages}
To save (or remove) a Message requires updating the folders member of the Message. When we save a Message, we store a pointer to the given Folder; when we remove a Message, we remove that pointer.
These operations must also update ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access