/* MyObj.h CIS 250 Feb 23, 2009 David Klick Implementation of MyObj class for tlist class test. */ #ifndef __MYOBJ_H_ #define __MYOBJ_H_ #include using std::cout; class MyObj { private: int num; public: MyObj(); MyObj(const int x); void print() const; int getNum() const; void setNum(const int x); bool equals(const MyObj* m) const; }; MyObj::MyObj() { setNum(0); } MyObj::MyObj(const int x) { setNum(x); } int MyObj::getNum() const { return num; } void MyObj::setNum(const int x) { num = x>=0 ? x : -x; } void MyObj::print() const { cout << num << " "; } bool MyObj::equals(const MyObj* m) const { return num == m->num; } #endif