      *>----------------------------------------------------------------
      *> NilObject is the object invoked whenever you try to invoke an
      *> object with a null object reference.
      *>
      *> Copyright (C) 1991-1999 Micro Focus International Ltd.
      *>
      *>----------------------------------------------------------------
      $set  mfoo
       class-id. nilobject data is protected
               inherits from base with data.


        object section.
        class-control.
           Base is class "base"
           nilobject is class "nil"
           MessageFileHandler is class "msgfh".

       class-object.

       object-storage section.

      *>----------------------------------------------------------------
      *> Return true if anObject is equal to NULL
      *>----------------------------------------------------------------
       method-id. "equal".
       linkage section.
       01 lnkbool           pic x comp-5.
           88 istrue        value 1.
           88 isfalse       value 0.
       01 lnkobject         usage object reference.

       procedure division using lnkobject returning lnkbool.
           if lnkobject = null
               set istrue to true
           else
               set isfalse to true
           end-if
           exit method.
       end method "equal".
      *>----------------------------------------------------------------
      *> Display "nil" on the screen
      *>----------------------------------------------------------------
       method-id. "display".
       local-storage section.
       01 lsString             usage object reference.
       01 i                       pic x(4) comp-5.
       01 j                    pic x(4) comp-5.
       01 lsmsgfh               object reference.
       procedure division.
           invoke self "registerBaseMessageFile"
                                returning lsmsgfh
           *>> LNG 12: "nil"
           move 2 to i
           move 12 to j
           invoke lsmsgfh "getmessage" using i j
                   returning lsstring
           invoke lsstring "display"
           invoke lsString "finalize" returning lsString
           invoke lsmsgfh "finalize" returning lsmsgfh

           exit method.
       end method "display".
      *>----------------------------------------------------------------
      *> Return NULL
      *>----------------------------------------------------------------
       method-id. "deepCopy".
       linkage section.
       01 result           usage object reference.

       procedure division returning result.
           set result to null
           exit method.
       end method "deepCopy".

      *>----------------------------------------------------------------
      *> Return NULL
      *>----------------------------------------------------------------
       method-id. "shallowCopy".
       linkage section.
       01 result           usage object reference.

       procedure division returning result.
           set result to null
           exit method.
       end method "shallowCopy".

      *>----------------------------------------------------------------
      *> Raise an exception as there can be no instances of NULL
      *>----------------------------------------------------------------
       method-id. "new".
       local-storage section.
       01 exceptionnumber  pic x(4) comp-5.

       linkage section.
       01 result           usage object reference.

       procedure division returning result.
           move 18 to exceptionnumber
           invoke self "raiseException" using exceptionnumber
                                       returning result
           exit method.
       end method "new".

      $if gc not defined  
      *>----------------------------------------------------------------
      *> Cannot finalize this class. Return Null
      *>----------------------------------------------------------------
       method-id. "finalize".
       linkage section.
       01 result               usage object reference.

       procedure division returning result.
           set result to null
           exit method.
       end method "finalize".
      $end

      *>----------------------------------------------------------------
      *> Return NULL
      *>----------------------------------------------------------------
       method-id. "copy".
       linkage section.
       01 result               usage object reference.

       procedure division returning result.
           set result to null
           exit method.
       end method "copy".

      *>----------------------------------------------------------------
      *> Return NULL
      *>----------------------------------------------------------------
       method-id. "getAddress".
       linkage section.
       01 result             pointer.

       procedure division returning result.
           set result to null
           exit method.
       end method "getAddress".

      *>----------------------------------------------------------------
      *> Return NULL.
      *>----------------------------------------------------------------
       method-id. "asParameter".
       linkage section.
       01 result             pic x(4) comp-5.

       procedure division returning result.
           move zero to result
           exit method.
       end method "asParameter".


      *>----------------------------------------------------------------
      *> Return a boolean indicating whether this static structure
      *> contains objects or not.
      *>----------------------------------------------------------------
       method-id. "storingObjects".
       linkage section.
       01 lnkBool                pic x comp-5.
        88 storingObjects       value 1.
        88 notstoringObjects       value 0.
       procedure division returning lnkBool.
           set notStoringobjects to true
           exit method.
       end method "storingObjects".

       end class-object.


       Object.

       object-storage section.

       end object.
       end class nilobject.
