Re: Classes in VB6

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance




"boaz" <nospam@xxxxxxxxx> wrote in message
news:OXhKj9PhGHA.4252@xxxxxxxxxxxxxxxxxxxxxxx
He says you cannot use the name of the variable as the name of the
function.
However, you can use the name of variable as the name of the "Property
Get".
So, it is easier to read.


<snipped>

But again it is purely a matter of opinion. And not an opinion that is
shared by all.

When it comes down to it, the 'syntatical advantage' only really make sense
when you have both a Get and a Let. [One could have just as easily named the
function "Junk()", but if you use a method for both, they have to have
different names.]
val = cls.Junk ' opposed to val = cls.getJunk()
cls.Junk = val ' cls.letJunk(val)

Implementation advantages are marginal and may even favor using a Method.

It isn't any easier if you try to limit Properties to 'class attributes' and
Methods to 'class behaviors'. Because while in some cases the difference is
obvious...
Class CPerson
Public Property get/let HairColor
Public Property get/let LastName
Public Sub ChangeNameByMarriage( sNewName As String)
msMaidenName = msLastName
msLastName = sNewName
End Sub
in others it gets a bit murky ....
Public Sub ChangeHairColor(sNewColor As E_CLAROL)
...

It depends if you are modeling a beauty saloon or a license bureau.

-ralph



.