Originally Posted by
tabstop
Well, that's ... well ... I don't know. There is never a point at which you need two copies of the same Piece of Clothing. I can't even come up a circumstance in which you might think you need two Pieces of Clothing, assuming we're storing pointers in all of our tables.
@kotoko
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):
Code:
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")
}
From this I can create one Outfit:
Code:
Outfit notSoCoolOutfit
{
IHat: * fedora,
IBelt: * NULL,
ITop: * redShirt,
IShoes: * grayTennisShoes,
IBottom: * tanShorts
}
In the Outfit notSoCoolOutfit I only point to the items in the piecesOfClothing vector. I don't actually have copies.