It looks like “HOLDS_A” is a slightly confusing way to refer to the relationship more commonly known as aggregation, where one object (here the modem) depends on another (here the fax), but does not own it: the modem doesn’t have exclusive access to the fax, and doesn’t manage its lifetime. This relationship can be realised in C++ by storing a pointer or reference to the other object, as your code demonstrates. Something else is responsible for creating a fax and providing the modem with a pointer to it.
This can be compared with the stronger relationship of composition, where the modem does own the fax. In this case, the fax is regarded as part of the modem, not a separate entity potentially used by many other objects. This relationship can sometimes be realised in C++ by making the fax itself a member of the modem class (so that it really is part of the modem); sometimes a pointer is still needed, but that should be a “smart” pointer such as std::unique_ptr
to manage the ownership relationship.
3
solved What is HOLDS_A relationship in C++? [closed]