PRODUCT : Borland C++ NUMBER : 1733 VERSION : All OS : All DATE : October 25, 1993 PAGE : 1/3 TITLE : A functionally complete class (for use with BIDS) Using the BIDS libraries requires a functionally complete class. That means the class must have the following: 1. A default constructor 2. A copy constructor 3. An assignment operator 4. Three comparison operators: a. equality, b. not equal, and c. less than 5. A hash value Not all of them are necessary, but if your class is a functionally complete class, then it can be used with any of the BIDS libraries. Thus, making it easier for you to experiment with which container would be more efficient for your application. Here is an example class: class MyClass { protected: char *str; public: // constructors MyClass(); MyClass(const char *s); // copy constructor MyClass(const MyClass &MC); // destructor ~MyClass(); // assignment operator MyClass& operator=(const MyClass &MC); // equality int operator==(const MyClass &MC) const; int operator!=(const MyClass &MC) const; // comparison for sorted containers PRODUCT : Borland C++ NUMBER : 1733 VERSION : All OS : All DATE : October 25, 1993 PAGE : 2/3 TITLE : A functionally complete class (for use with BIDS) int operator<(const MyClass &MC) const; // for hashtables unsigned hashValue() const; }; inline MyClass::MyClass() { str = NULL; } inline MyClass::MyClass(const char *s) { str = new char[strlen(s)+1]; strcpy(str, s); } inline MyClass::MyClass(const MyClass &MC) { if (MC.str) { str = new char[strlen(MC.str)+1]; strcpy(str, MC.str); } else str = NULL; } inline MyClass::~MyClass() { if (str) delete str; } inline MyClass& MyClass::operator =(const MyClass &MC) { if (str != NULL) delete str; if (MC.str) { str = new char[strlen(MC.str)+1]; strcpy(str, MC.str); } PRODUCT : Borland C++ NUMBER : 1733 VERSION : All OS : All DATE : October 25, 1993 PAGE : 3/3 TITLE : A functionally complete class (for use with BIDS) else str = NULL; return *this; } inline int MyClass::operator ==(const MyClass &MC) const { return strcmp(str, MC.str) == 0; } inline int MyClass::operator !=(const MyClass &MC) const { return !(*this == MC); } inline int MyClass::operator <(const MyClass &MC) const { return strcmp(str, MC.str) < 0; } inline unsigned MyClass::hashValue() const { unsigned Hash = 0; if (str == NULL) return 0; for (int i=0; i