thanks for the response. i'll just be more specific.
error: 'HashValue' does not name a type
when compiling the following code:
-
#include<iostream>
-
using namespace std;
-
#include <typeinfo>
-
-
class Object
-
{
-
protected:
-
virtual int CompareTo (Object const&) const = 0;
-
public:
-
virtual ~Object ();
-
virtual bool IsNull () const;
-
virtual int Compare (Object const&) const;
-
virtual HashValue Hash () const = 0;
-
virtual void Put (ostream&) const = 0;
-
};
-
inline bool operator == (Object const& left, Object const& right)
-
{ return left.Compare (right) == 0; }
-
-
inline bool operator != (Object const& left, Object const& right)
-
{ return left.Compare (right) != 0; }
-
-
inline bool operator <= (Object const& left, Object const& right)
-
{ return left.Compare (right) <= 0; }
-
-
inline bool operator < (Object const& left, Object const& right)
-
{ return left.Compare (right) < 0; }
-
-
inline bool operator >= (Object const& left, Object const& right)
-
{ return left.Compare (right) >= 0; }
-
-
inline bool operator > (Object const& left, Object const& right)
-
{ return left.Compare (right) > 0; }
-
-
inline ostream& operator << (ostream& s, Object const& object)
-
{ object.Put (s); return s; }
-
-
-
Object::~Object ()
-
{}
-
-
bool Object::IsNull () const
-
{ return false; }
-
-
int Object::Compare (Object const& object) const
-
{
-
if (typeid (*this) == typeid (object))
-
return CompareTo (object);
-
else if (typeid (*this).before (typeid (object)))
-
return -1;
-
else
-
return 1;
-
}
-
section from the book i'm trying to implement:
Objects in Bruno Preiss's book
Also, not that it matters but this isn't for any class.