// ***************************************************************** // Author: Zhixiang Chen // Class: CSCI/CMPE 2380, Spring 2009 // Lab 4: Header file for Lab 4 // Date: January 13, 2009 // Comment: The code here is meant to be revised. // ***************************************************************** #include using namespace std; #ifndef LAB2380_4_HEAD_H #define LAB2380_4_HEAD_H /************************************************************* * declarae a valueType class template * the data member value is of generic type ************************************************************/ template class valueType { public: bool operator==(const valueType&) const; // == overloading bool operator<(const valueType&) const; // > overloading bool operator>(const valueType&) const; // < overloading const valueType & operator=(const valueType&); // = overloading void setValue(const type &); // set the full name void getValue(type &); // get the full name void printValue(); // print value //valueType(); // default constructor valueType(const type& x=type()); // a constructor with parameters valueType(const valueType&); // copy constructor ~valueType(); //destructor private: type value; // store the value }; //overload == operator template bool valueType::operator==(const valueType& x) const { return value == x; } //overload < operator template bool valueType::operator<(const valueType& x) const { return value < x; } //overload > operator template bool valueType::operator>(const valueType& x) const { return value > x; } //copy constructor template const valueType & valueType::operator=(const valueType & x) { if (this != & x) { value = x.value; } return *this; } //set value template void valueType::setValue(const type & x) { value = x; } //get value template void valueType::getValue(type & x) { x = value; } //get value template void valueType::printValue() { cout< valueType::valueType() // default constructor { //value = 0; } */ //another constructor template valueType::valueType(const type & x=type()) // a constructor { value = x; } //copy constructor template valueType::valueType(const valueType & x) { if (this != &x) { value = x.value; } } // desconstructor template valueType::~valueType( ) { } #endif