View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
pinkfloydfan pinkfloydfan is offline
external usenet poster
 
Posts: 68
Default What of these is the correct syntax to refer to Properties?

Hi all

Just a simple question really: I was wondering if there was an
accepted syntax for refering to already defined properties when
writing a sub/function in the same class.

For example:

<Declarations
Private lBaseNum as Long
</Declarations

<Class1 Code
Public Property Get BaseNumber() As Long
BaseNumber = lBaseNum
End Property

Public Property Let BaseNumber(ByVal vNewValue As Long)
lBaseNum = vNewValue
End Property

Public Function AdjBaseNumber(Adj as Long)
AdjBaseNumber = BaseNumber + Adj
End Function
</Class1 Code

The question arises in the Function AdjBaseNumber, which of the
following is correct:
a) AdjBaseNumber = BaseNumber + Adj
b) AdjBaseNumber = lBaseNum + Adj

In a) I reference the Property (BaseNumber) but in b) I reference the
Private variable (lBaseNum)

Does it make any difference?

Thanks a lot
Lloyd