Override .NET abstract properties
- Last Updated: June 19, 2019
- 2 minute read
- OpenEdge
- Version 13.0
- Documentation
You can override a .NET abstract property
(defined with the C# abstract option) inherited
by an ABL class as long as the .NET abstract property is not
an indexed property. The rules for overriding a .NET abstract
property are very similar to overriding an ABL abstract property
using the OVERRIDE option of the DEFINE
PROPERTY statement.
For example, the overriding ABL
property must have an ABL access mode that is equivalent to, or
less restrictive than, the access level of the overridden .NET abstract
property. The overriding ABL property must define the same accessor
specified for the .NET abstract property, but can add the
missing accessor if necessary. Thus, if the .NET abstract
property has a C# get, the overriding ABL property
must have a GET, and if the .NET property
prototype has a C# set, the overriding ABL property
must have a SET.
The overriding ABL property
can also be defined as abstract (using the ABSTRACT option)
as long as the inheriting ABL class is abstract. However, as for
any ABL abstract property, the first non-abstract ABL subclass must
implement the inherited .NET abstract property unless an abstract
ABL subclass implements the property higher in the class hierarchy.
The primary difference in overriding a .NET abstract property is how to match the data type in the overriding ABL property definition when the .NET property has a .NET mapped data type. If the data type of the .NET abstract property is a .NET mapped data type, you must define the ABL property data type using the rules for explicitly mapping .NET data types. For more information, see Explicit data type mappings.
For
example, you might have an ABL class implement an Area .NET abstract
property from a .NET abstract super class, Shape,
that is defined like this:
|
In this example, you define an ABL Rectangle class to
inherit the .NET Shape class and implement
its abstract Area property:
|