Warning: Assigning {source}, an abstract class, to ‘{name}’ declared as {target}
Set gives a #Dim‘d variable, or a call gives a typed parameter, a value typed as an
abstract class where a subclass of it is declared. No instance is of the abstract class
itself, so the value is some subclass’s, which may be the declared one: IRIS compiles and
runs the code, and it fails only when another subclass’s instance arrives. Test %IsA
first where one can.
IRIS compiles the example.
Class Demo.DowncastFromAbstract Extends %RegisteredObject [ Abstract ]
{
Property Name As %String;
}
IRIS compiles the example.
Class Demo.DowncastFromAbstractCircle Extends Demo.DowncastFromAbstract
{
Property Radius As %Numeric;
ClassMethod Diameter(circle As Demo.DowncastFromAbstractCircle) As %Numeric
{
Quit circle.Radius * 2
}
ClassMethod Call(shape As Demo.DowncastFromAbstract) As %Numeric
{
Quit ..Diameter(shape) //! A6274
}
}