Accessing a Member Variable

A member variable of an object is treated much like any other FoxPro variable. It can be used, modified, queried, and so forth. The only difference is that a member variable is always referenced with its object as follows:


? oObject.<MemVarName>
oObject.<MemVarName> = <Value>

Remember, if a member variable is protected, attempting to access it outside of the class will produce an error.

Finally, you can access a member from an object that is contained within another object by accessing the variable with the full object hierarchy. For example, assume we had a member called STATUS of oLight. Assuming that oLight is a member of oPhone., we would access the STATUS member as follows:


? oPhone.oLight.Status