How Inheritance Affects PROTECTED Methods and Properties (128633)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
This article was previously published under Q128633 SUMMARY
This article explains how protected properties and methods are inherited
when a class is derived from another class definition. It specifically
addresses these issues:
- Whether a protected class member is inherited and thus visible to a
derived class.
- Whether it is possible to modify the protected status of a member
variable.
MORE INFORMATION
Members variables (properties) or procedures (methods) are by default
visible outside a class definition. Once an object has been instantiated,
its properties and methods can be accessed by other objects. The PROTECTED
keyword prevents access to the Object's properties and methods from outside
the object's definition.
A PROTECTED property or method is visible to the member functions of the
class that declared these members, and it is visible to the member
functions of a class derived from this class. In other words, protected
properties, objects members, and methods are inherited.
When PROTECTED members are inherited, they still have a PROTECTED status.
Although it is possible to redefine the content of properties and methods
in a derived class, the PROTECTED status of a member variable cannot be
overridden. If you need to modify this status in a subclass, you can add a
member variable to the class. The goal of the new property or method that
is visible to other objects is to access the PROTECTED member variable from
within the class definition.
Modification Type: | Major | Last Reviewed: | 2/12/2000 |
---|
Keywords: | KB128633 |
---|
|