March 2004
Intermediate to advanced
432 pages
7h 14m
English
The previous chapter discussed executable statements (methods) as type members, so now it is worth talking about variables as type members. Like local variables, which are locations to store information in methods, fields and properties are locations that store information in classes or structures.
A field is a variable that lives in a class or a structure instead of inside a method. Fields are declared in exactly the same way that local variables are declared.
Module Test Dim x As Integer Dim y As Long = 5 Dim z(5) As Integer End Module
Instance fields live as long as the class or structure that contains them lives, while shared fields live for the length of the program's execution. Fields declared in modules ...
Read now
Unlock full access