FIX: Public Properties of VB4 Class Are Passed by Reference (166928)
The information in this article applies to:
- Microsoft Visual Basic Control Creation Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 4.0
- Microsoft Visual Basic Enterprise Edition for Windows 4.0
This article was previously published under Q166928 SYMPTOMS
If you have a Visual Basic 4.0 class with a public property implemented
like the following:
Public MyProp As Integer
Visual Basic 4.0 passes the property by reference (ByRef).
However, if your property is implemented in Visual Basic 4.0 using property
procedures (Property Get, Property Let, Property Set), it will be passed by
value (ByVal).
STATUS
This problem has been fixed in Visual Basic 5.0. All properties are now
passed by value (ByVal) for consistency.
In addition, all code internal to the class still has direct access to
member variable data:
MyClass.CLS
===========
Public MyProp As Integer
Public Sub MyMethod()
MyProp = 5 '// This has direct access to the class data
End Sub
===========
Modification Type: | Major | Last Reviewed: | 6/29/2004 |
---|
Keywords: | kbbug kbfix KB166928 |
---|
|