Hi,
I am trying to understand Class objects and have the following question regarding Property Get and Property Let functions.
Functionally, it seems they are just assigning or obtaining values for the property variables. Why can't we just assign them directly as values to variables instead of putting them through the Property Get (or Let)........Property End code.
In the examples I have seen, for eg.
Why not just use:
Thanks,
pkh
I am trying to understand Class objects and have the following question regarding Property Get and Property Let functions.
Functionally, it seems they are just assigning or obtaining values for the property variables. Why can't we just assign them directly as values to variables instead of putting them through the Property Get (or Let)........Property End code.
In the examples I have seen, for eg.
Code:
Private pName as String
Public Property Get Name () As String
Name = pName
End Property
Public Property Let Name (Value As String)
pName = Value
End Property
' these examples are from C Pearson's VBA lessons
Why not just use:
Code:
Private pName as String
Sub WhateverCode()
Dim Name as String
Name=pName
pName = pkh
End Sub
Thanks,
pkh