execute method calls

execute method calls - Executing method calls Introduction...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Executing method calls Introduction It is important that you understand how a method call is executed, for several reasons. This knowledge will give you a better understanding of how a program is executed. You may have to execute a call yourself, by hand, in order to debug a program. Knowledge of how a call is executed is useful in analyzing the time and space requirements of a program. Finally, this knowledge will also be extremely valuable when you learn about recursion. So let’s begin. The frame for a call Here is an object of class Employee . We show only one field and one method, function num . We have drawn the method body here, too, in order to make clear what is happening. This method yields the number of times its parameter c occurs in the name of the employee. We have labeled the statements with numbers so that we can refer to them later. We will illustrate using the call v.num('e') . When a call is executed, a frame for the call is created. It contains information that is needed in order to ex- ecute the call. How it is stored in a computer doesn’t matter; here, we describe how we draw frames when we ecute the call....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online