Skip to main content
4 events
when toggle format what by license comment
Mar 28, 2024 at 14:22 comment added Booboo First of all, in principle you could have many different instances of Phonebook each initialized with different unformatted phonebook files, even if that is not your particular use case. Even with a single instance the class, the class encapsulates the creation of the dictionary that holds the mapping between phone number and name/address info and the method(s) for accessing that dictionary. Think of the class as an implementation of a "phonebook" abstract data type that allows a client via the method lookup_by_phone to get information from it without having to know how it works.
Mar 28, 2024 at 13:05 comment added Vessel Thanks for the help. As I understood it, classes were used to make objects that could be reüsed - wouldn't this Phonebook class only have one instance of itself, and thus not be very useful as a class?
Mar 27, 2024 at 13:37 history edited Booboo CC BY-SA 4.0
Remove obsolete comment.
Mar 27, 2024 at 13:27 history answered Booboo CC BY-SA 4.0