.ModelicaReference.'partial'

Information

Prohibit instantiation of components of the class

Examples

partial block PartialBlock
  input Real u;
  output Real y;
protected
  Real x;
equation
  x = y;
end PartialBlock;

block Integrator
  extends PartialBlock;
equation
  der(x) = u;
end Integrator;

block Gain
  extends PartialBlock;
  parameter k = 1;
equation
  x = k*u;
end Gain;

model Composition
  PartialBlock block1; // Illegal
  Integrator block2; // Legal
  Gain block3; // Legal
end Composition;

Syntax

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

class_specifier :
   string_comment composition end IDENT
   | "=" base_prefix name [ array_subscripts ] [ class_modification ] comment
   | "=" enumeration "(" ( [enum_list] | ":" ) ")" comment

Description

The keyword partial defines that a class is incomplete and that it cannot be instantiated. For example, defining

   PartialBlock block1;

is illegal. A partial class can only be used in an "extends" clause to inherit from it or in a "constrained" clause to define the constraints of a replaceable class.


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