Error in VM Code on page 237?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error in VM Code on page 237?

Mike In Chicago
In the "Final VM Code" section on page 237 (chapter 11), it includes the following line of code:

"call BankAccount.commission 2"

However, in the high level code that appears on page 236, the commission method is shown to take only 1 argument.  

Since call functions are of the type "call <function name> <number of arguments pushed on stack>", should this actually read "call BankAccount.commission 1"?

Reply | Threaded
Open this post in threaded view
|

Re: Error in VM Code on page 237?

cadet1620
Administrator
Mike In Chicago wrote
In the "Final VM Code" section on page 237 (chapter 11), it includes the following line of code:

"call BankAccount.commission 2"

However, in the high level code that appears on page 236, the commission method is shown to take only 1 argument.  

Since call functions are of the type "call <function name> <number of arguments pushed on stack>", should this actually read "call BankAccount.commission 1"?
BankAccount.commission() is a method so it has the object's pointer as a hidden first argument.

The "push argument 0" is the first argument to commission().

--Mark