MATH 1P98 Lecture Notes - Lecture 6: Cosc, Instance Variable, Local Variable

12 views1 pages
raining258 and 36452 others unlocked
MATH 1P98 Full Course Notes
99
MATH 1P98 Full Course Notes
Verified Note
99 documents

Document Summary

Cosc 1p02 tutorial exercise 3 feb 4th, 2020. In this exercise we will look at the concepts of scope and parameter passing. Scope rules define which declaration (which actual storage location) is associated with each use of a variable (or other) name. The text (section 3. 6) describes four rules for resolving scope (finding the declaration to which a use refers): Look for a declaration of the name in the method (or constructor) in which the code resides. If one exists, this is the defining declaration. This rule applies to both formal parameter declarations and local declarations. If no such declaration exists, apply step 1 looking in the immediately enclosing code unit normally this would be a class declaration. If no such declaration exists, check the public declarations of public classes from imported packages. This is how the names turtle, forward, pi, and sin that are imported from the media and math packages are resolved.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related textbook solutions

Related Documents

Related Questions