Similarities and Differences between local variables and properties
Same point:
- Format-defined variables: variable name = data type variable value
- After the first use statement
- Variable has its corresponding scope
difference:
-
Different positions in the class declaration of
attributes: a pair of directly defined within {} class
local variables: variables in the process, process parameters within the code block, the constructor parameter, the internal statement constructor -
Permissions on different modifier
attributes: You can declare properties when specifying their rights, usage rights modifier
local variables: not use Permissions modifier -
The default initialization value distinct
properties: property class, according to their type, have default initialization values (default initialization value like array)
local variables: no default initialization value