This is a good thought.  I would have written the class this way if I were implementing it.  It hides the implementation details from the caller so he doesn't know or care that the internals of the class use a hash to store pets.