I was wondering what the best (most effective way) of accessing instance variables in a class is?? Would the best way be though methods (such as a return method) or directly manipulating the variable?
The variables should be Private and encapsulated as properties of the object with Property Get and Let functions to save and retreive them. This allows for validation when they are stored and a default to be included.
Where the variable is dependent on other Methods it should be read only (no Let function) so that they cannot be written to other than via...
The variables should be Private and encapsulated as properties of the object with Property Get and Let functions to save and retreive them. This allows for validation when they are stored and a default to be included.
Where the variable is dependent on other Methods it should be read only (no Let function) so that they cannot be written to other than via the outcomes of the method.
None of this is possible with direct access to a Public variable.
Sorry, we can't find any related questions. Try using the search bar at the top of the page to search for some keywords, or choose a topic and submit your own question.