Prohibit instantiation of components of the class
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;
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
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.