Try OpenEdge Now
skip to main content
GUI for .NET Programming
Accessing and Managing .NET Classes from ABL : Defining ABL-extended .NET objects : Deriving .NET classes in ABL : Overriding .NET abstract properties
 
Overriding .NET abstract properties
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:
public abstractdoubleArea { get; }
In this example, you define an ABL Rectangle class to inherit the .NET Shape class and implement its abstract Area property:
CLASS Rectangle INHERITS Shape:

  DEFINE PUBLIC PROPERTY Width AS DECIMAL NO-UNDO
    GET.
    SET.
  DEFINE PUBLIC PROPERTY Height AS DECIMAL NO-UNDO
    GET.
    SET.

  DEFINE PUBLIC PROPERTY OVERRIDE Area AS DOUBLE NO-UNDO
    GET:
      /* Given the Width and Height, return the area of a rectangle */
      RETURN Width * Height.
    END.

...

END CLASS.