![]() |
![]() |
|
home—info—lectures—exams—archive
We saw three different variants on (static) scoping mechanisms last time. Scheme named them differently (let vs. let* vs. letrec), whereas Java uses let* for names of local variables and fields, and letrec for names of methods.
class Foo { //int b = 9; int foo( int a ) { // Try swapping these two next lines; not differing error message. a = b; int b; b = 5; //int c; for (int c = 0; c < 3; ++c ) { //int c; c = 9; } //return c; return -99; } |
Implementing fields. Note that each (pair of) functions has its own closure.
Next time, we'll continue by thinking about how to (essentially) makes subclasses of this class rng.
home—info—lectures—exams—archive
©2008, Ian Barland, Radford University Last modified 2008.Oct.29 (Wed) |
Please mail any suggestions (incl. typos, broken links) to ibarland ![]() |
![]() |