This is probably a silly question, but I'm becoming suspicious I'm not realizing some better design.
On a few cases, I have classes designed with a rich interface being used as aggregatees on other classes:
CInventory has a well delineated interface. Functions to equip and unequip items, drop and pick them, and much more.Code:class CBeing { /* ... */ private: CInventory inv_; };
The above example forces me to expose CInventory interface by adding to CBeing interface function members that basically all they do is call inv_ own methods. Only a very small subset of CInventory interface will not be exposed through CBeing. Note this is meant to be an aggregation. inv_ will be destroyed when CBeing is destroyed.
It's not that it shocks me. However, it makes me suspicious that I'm failing to realize some other better choice than carrying over to the aggregator an aggregatee's interface.
Is there?