18.04.2015 Views

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

ArcGIS Engine Developer Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

THE V ISUAL BASIC 6 ENVIRONMENT<br />

For instance, you might have decided that a variable has a valid range of 1–100.<br />

If you were to allow other developers direct access to that variable, they could<br />

set the value to an illegal value. The only way of coping with these illegal values<br />

is to check them before they get used. This is both error prone and tiresome to<br />

program. The technique of declaring all variables as private member variables of<br />

the class and providing accessor and mutator functions for manipulating these<br />

variables will solve this problem.<br />

In the example below, these properties are added to the default interface of the<br />

class. Notice the technique used to raise an error to the client.<br />

Private m_lPercentage As Long<br />

Public Property Get Percentage() As Long<br />

Percentage = m_lPercentage<br />

End Property<br />

Public Property Let Percentage(ByVal lNewValue As Long)<br />

If (lNewValue >= 0) And (lNewValue

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!