I have a bag:
Code:
class bag
    { 
    public:
        // TYPEDEFS and MEMBER CONSTANTS
		typedef Die value_type;
        typedef std::size_t size_type;
        static const size_type CAPACITY = 30;
        // CONSTRUCTOR
        bag( ) { used = 0; } 
        // MODIFICATION MEMBER FUNCTIONS
        size_type erase(const value_type& target);
        bool erase_one(const value_type& target);
        void insert(const value_type& entry);
        void operator +=(const bag& addend);
        // CONSTANT MEMBER FUNCTIONS
        size_type size( ) const { return used; }
        size_type count(const value_type& target) const;
        value_type getItem(int element) const;
    private:
        value_type data[CAPACITY];  // The array to store items
        size_type used;             // How much of array is used
    };
and I am trying to call the roll() function of the die class through a bag object's getItem() function, getItem simply returns data[element] (a single die in this case)...however, using this line of code:
Code:
//Roll the dice in rollingDice and add face value to sumFace
	for (int i = 0; i < numRoll; ++i)
	{
		rollingDice.getItem(i).roll();
		cout << rollingDice.getItem(i).getFace();
		//sumFace = sumFace + rollingDice.getItem(i).getFace();
	}
does not alter the face value at all, here's roll():
Code:
void Die::roll()
{
	int randNum = genRand(1, numSides);
	setFace(randNum);
}
and I am completely confused as to why the face value of the Die within the Bag is not being altered...any idea why this is happening?