Академический Документы
Профессиональный Документы
Культура Документы
Scope, Visibility,
and Lifetime
Scope, Visibility, and Lifetime:
4-2
Static Scope:
4-4
Lifetime:
4-5
Identifier reuse:
4-6
Identifier reuse:
4-7
Example Program with
Functions and Parameters
Figure 4.5
4-8
What is a Scope?
4-9
Scope Example:
…
If (a[j] > a[k]) {
int t = a[j];
a[j] = a[k];
a[k] = t;
}
4-10
Scope Example:
…
for (int i=0; i<10; i++) {
sum = a[i];
}
…
j = i;
4-12
Overloading Example:
4-13
New Abstract Syntax Rules
for Jay with Methods and Globals
Figure 4.6
4-14
Abstract Syntax Sketch for a Jay
Program with Globals and Methods
Figure 4.7
4-15
Next time…
Memory
Management
4-16