go to previous page   go to home page   go to next page hear noise highlighting

Answer:

  1. Add an entry to the jump table of each object.
  2. Add the code for the method to the program.

Since the layout of the object has changed, some other small changes also need to be made.


cancel() Method

Let us add the cancel() method to the objects. This (somewhat silly) method replaces all the characters of an object's string with x's.

Here is the new design for an object:

                                         # jump table:
byte 0-3: address of print()             # first entry point
byte 4-7: address of cancel()            # second entry point
                                         # data:
byte 4- : null terminated string         # as many bytes as needed

QUESTION 16:

Complete the declaration for object1::

object1:
          .word              # entry point for print
.word # entry point for cancel
.asciiz # string data

go to previous page   go to home page   go to next page