Next: 3.2.2 Local Parameters
Up: 3.2 MDL Classes
Previous: 3.2 MDL Classes
3.2.1 Interface Parameters
New interface parameters can be defined by listing them in the
Interface block statement of an MDL model definition. Every MDL
model can contain one Interface block statement which is initiated by
using the Interface keyword followed by a list of parameter
definitions enclosed in braces:
Interface {
protection Parameter<type> name = initial_value;
}
The definition of a parameter itself consists of a sequence of the
following elements:
- the optional protection field specifies if this interface
parameter will be inherited by derived MDL classes. Possible values
for this field are protected and private. The default
protection assumed when this field is omitted is private.
Parameters marked as protected will be inherited by derived
classes, while private parameters are only members of the actual
MDL class itself.
- the keyword Parameter
- an optional MDL parameter type specification
(<type>) which consists of the MDL parameter type name
enclosed in a pair of ``<>''. The type specification can be
omitted if the actual type of the interface parameter is already
determined by the initialization or linkage of the parameter.
- the name of the interface parameter
- the optional initial value can be any valid MDL statement with an
appropriate result type preceded by the operator ``=''.
Interface parameters can be referred to within all methods of the MDL
class by using the ``:'' qualifier.
Various definitions of interface parameters are demonstrated in
Example 3.10.
Interface {
Parameter<double> x;
private Parameter<int> y = 1 + 2*3;
protected Parameter<MdlString> name = "Hugo";
}
Example 3.10: Interface definition
Next: 3.2.2 Local Parameters
Up: 3.2 MDL Classes
Previous: 3.2 MDL Classes
Robert Mlekus
1999-11-14