Wednesday, October 27, 2010

Programming State

An object state (things the object has - attributes like Name, Price, Damage) is simply a value that needs to be stored in memory. Object states are implemented as constants or variables.

Note: Other terms for state include property, attribute and data member.


Constant
When we need to store a value that does not change, we declare a constant.

Code eg: Constant Declaration
Private Const strThisConstant As String = "Something"

        Variable
         When we need to store a value that will need to change, we use a variable.

Code eg: Variable Declaration
Private strThisVariable As String = "Something"

No comments:

Post a Comment