Go to the previous, next section.
#include <nihcl/Object.h>
There is but a single instance of class
Nil
, which is accessible via a public static pointer member variable
Object::nil
:
static Object* const nil;
Pointers to the
Nil
object are used as placeholders by container classes such as
Set
and
ArrayOb
, and sometimes as a "failure" return object from functions that perform a search, for example.
The advantage of using a pointer to the
Nil
object rather than a 0 (or
NULL
) pointer is that applying a member function to a 0 pointer is an error. To avoid this, it is necessary to check that a pointer is non-zero before applying a member function to the object it references. However, using a pointer to the
Nil
object eliminates the need for this test.
Nil()
Nil
. This constructor is
not accessible
to library users.
virtual unsigned hash() const
virtual int compare(const Object&
ob) const
nil
object; otherwise, raises an
NIHCL_BADARGSPM
exception.
virtual bool isEqual(const Object&
ob) const;
YES
if
ob
is the
Nil
object.
virtual Object* copy() const
Nil
object.
virtual void dumpOn(ostream&
strm
=cerr) const
virtual void printOn(ostream&
strm
=cout) const
"NIL"
on the output stream
strm.
virtual void deepenShallowCopy()
virtual void storer(OIOout&) const
virtual void storer(OIOofd&) const
shouldNotImplement()
.
NIHCL_BADARGSPM
Go to the previous, next section.