How to Create and Access Protected Properties (131133)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
This article was previously published under Q131133 SUMMARY
In Visual FoxPro, programmers can make user-defined object properties
visible only to the events and methods for the defined object by protecting
them from access by outside objects. Protected properties can only be
altered or referenced by using the object's methods and events.
By using the PROTECTED keyword for properties in a class definition,
protected properties cannot be changed by other objects. For example, when
designing a form class that has a command button, the command button is
unable to modify the PROTECTED Methods or Properties of the form class.
This article shows by example how to create a new custom class with some
protected properties and a custom method ProtProperty. The protected
properties cannot be accessed by external commands unless they use the
custom method (ProtProperty) of the object.
Modification Type: | Major | Last Reviewed: | 2/15/2000 |
---|
Keywords: | kbcode KB131133 |
---|
|