PRB: Access Method Fires for Properties that Do Not Exist (190789)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 6.0
This article was previously published under Q190789 SYMPTOMS
Accessing a property that does not exist in a class still fires the Access
method.
CAUSE
This behavior permits the design of classes that support the addition of
custom properties at run-time using the AddProperty method. For example,
the following class definition adds a new property to the class at run-time
when a non-existent property is accessed:
x = NewObject("myclass")
?x.NewProp && New Property will be added to class.
?x.NewProp && Note new property value.
x.NewProp="Hello" && Value assigned since property already exists.
?x.newprop
DEFINE Class myclass as Custom
PROCEDURE this_access(tcMember)
IF ! PEMStatus(this,tcMember,5)
this.AddProperty(tcMember)
ENDIF
RETURN this
ENDPROC
ENDDEFINE
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 12/11/1999 |
---|
Keywords: | kbprb KB190789 |
---|
|