![]() |
Diff btwn Dim x and Private x in class module?
Walkenbach uses examples of Dim x and Private x for non-public
variables in a class module. Is there any semantic difference? I cannot see any. For example: myTest class module: Dim xCnt As Long Private xIdx As Long Private Sub Class_Initialize() xCnt = xCnt + 1 MsgBox xCnt End Sub Property Get cnt() cnt = xCnt End Property Property Let idx(x As Long) xIdx = x End Property Property Get idx() As Long idx = xIdx End Property ----- regular module: Sub testit() Dim a As myTest, b As myTest Set a = New myTest MsgBox a.idx & " " & a.cnt 'initial values a.idx = 2 MsgBox a.idx & " " & a.cnt 'changed values Set b = New myTest MsgBox b.idx & " " & b.cnt 'initial values End Sub |
All times are GMT +1. The time now is 02:08 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com