#ifndef STORE_CLASS #define STORE_CLASS #include using namespace std; template class store { public: store(const T& item = T()); // constructor // access and update functions T getValue() const; // return value void setValue(const T& item); // update value // overloaded operator << as a friend friend ostream& operator<< (ostream& ostr, const store& obj) { ostr << "Value = " << obj.value; return ostr; } private: // data stored by the object T value; }; // use an initialization list to assign value template store::store(const T& item): value(item) {} // return the current value template T store::getValue() const { return value; } // assign the argument as the new data member value template void store::setValue(const T& item) { value = item; } #endif // STORE_CLASS