Originally Posted by tabstop
I think if you have a vector of IPieceOfClothing objects, then that can be where they live, and the outfits can "borrow" those objects by pointing to them, hence pointers.
For example (Not actual C++ code, and probably a specialized collection using multiple vectors would help a little more):
From this I can create one Outfit:
vector<* IPieceOfClothing> piecesOfClothing =
IHat fedora(name: "Fedora", patternOrColor: "Brown"),
ITop redShirt(name: "Red Shirt", patternOrColor: "Red Plaid"),
IShoes grayTennisShoes(name: "Gray Tennis Shoes", style: "Tennis Shoes", isFormal: false, patternOrColor: "Gray"),
IBottom tanShorts(name: "Tan Shorts", patternOrColor: "Tan")
In the Outfit notSoCoolOutfit I only point to the items in the piecesOfClothing vector. I don't actually have copies.
IHat: * fedora,
IBelt: * NULL,
ITop: * redShirt,
IShoes: * grayTennisShoes,
IBottom: * tanShorts