.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

See section on class_definition in the Modelica Grammar.

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 "constrainedby" clause to define the constraints of a replaceable class.


Generated at 2024-11-22T19:25:38Z by OpenModelicaOpenModelica 1.24.2 using GenerateDoc.mos