This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: 3/1----Scope Variables can be referenced form limited parts of an application. The scope of a variable is the part of the application where it is visible Class… Dim x… Sub… Sub… Dim y… For….. Dim Z…. Function….-----Module scope Any procedure in the class can access Declared inside class, outside any procedure---------(X) which is called instance variables Scope goes from “Class” to “End Class”-----Procedure Scope Declared inside procedure (inside Sub, Function), outside any control structure (Y) Can be referenced anywhere inside procedure, nowhere outside. Parameters have procedure scope-----Block scope Declared inside some control structure Visible only the control structure If test >= 10 then Dim count as integer For count=1 To 10 . Next End if-------Local variables Procedure or block scope If local variable has the same name as instance variable (Dim X in the Function box above) Instance variable is hidden within local variables’ scope-----not recommended because it’s confusing...
View Full Document
- Fall '10
- Subroutine, Local variable