educative.io

Why does el librarian class include addBook and AddMember?

when you think of it implementation wise, that doesn’t make sense.A Librarian adds a book to a catalog and thus the class containing the list of books should be the one that has that ?

The Catalog class should hold all books. So the Catalog class should have an addBook. I believe the Librarian class should have a “wrapper” function named “addBook” as well which wraps Catalog’s addBook function call inside of it

I believe there should still be a distinction between who can “AddBook”, but not sure what the best way to implement this logic would be.