.ModelicaReference.'encapsulated'

Information

Break lookup in hierarchy

Examples

encapsulated model Test
  import Modelica.Mechanics.Rotational;

  Rotational.Components.Inertia inertia; // lookup successful
  Modelica.Mechanics.Translational.SlidingMass slidingMass; // lookup fails
equation
  ...
end Test;

Syntax

class_definition :
   [ encapsulated ]
   [ partial ]
   ( class | model | record | block | connector | type |
     package | function )
   IDENT class_specifier

Description

When an element, equation or algorithm is instantiated, any name is looked up sequentially in each member of the ordered set of parents until a match is found or a parent is encapsulated. In the latter case the lookup stops except for the predefined types, functions and operators defined in this specification. For these cases the lookup continues in the global scope, where they are defined. [E.g., abs is searched upwards in the hierarchy as usual. If an encapsulated boundary is reached, abs is searched in the global scope instead. The operator abs cannot be redefined in the global scope, because an existing class cannot be redefined at the same level.]


Generated at 2020-06-05T07:38:22Z by OpenModelica 1.16.0~dev-420-gc007a39