December 22, 2024
Answer to Q3
The object returned is the string
'''William Gates III'''
When holder is sent to the Account instance the string 'William
Gates III' is returned.
This string acts as the receiver to the printString message. Remember what
printString does.
"Answer a String whose characters are a description of the receiver."
The characters that describe the receiver 'William Gates III' are 'William
Gates III'. So what were delimiters are now to be treated as characters.
In Smalltalk, however, a ' character must be accompanied by another
', otherwise
Smalltalk treats them as delimiters.
The string object that is finally returned is the 'William Gates III' characters,
plus the extra ' characters, with the delimiters ' at each end. Giving:
'''William Gates III'''
The textual representation of this message answer is
'''William Gates III'''
Back to « Basic Questions
⇑ Up to top of page