Opened 15 years ago

Last modified 14 years ago

#1147 closed discussion (fixed)

Allow to modify protected parameter in extended class (from Mathcore)

Reported by: brugard Owned by: brugard
Priority: critical Milestone: Red October
Component: Version:
Keywords: Cc: brugard,

Description

See the models:

model test
  Real x;
protected 
  parameter Real A=10;
equation 
  x=A;
end test;
model testB
  extends test(A=30);
end testB;

When checking class B it gives the error message:

--- [10] 11:28:04 Validation of class testB ---
Check of testB completed successfully.
Error: Trying to modify protected element A
Class testB has 1 equation(s) and 1 variable(s).
1 of these are trivial equation(s).

But modifying protected variables should be allowed when extending the base class.

Note: The specification has a flaw, see comments.

Change History (4)

comment:2 Changed 15 years ago by brugard

7.1.2 Inheritance of Protected and Public Elements
If an extends-clause is used under the protected heading, all elements of the base class become protected
elements of the current class. If an extends-clause is a public element, all elements of the base class are inherited
with their own protection. The eventual headings protected and public from the base class do not affect the
consequent elements of the current class (i.e., headings protected and public are not inherited).

The specification has a flaw.

comment:3 Changed 14 years ago by adrpo

This should be part of milestone Red October (deadline 2010-10-15).

comment:4 Changed 14 years ago by perost

This seems to have been fixed already, since checkModel(testB) doesn't give any error messages.

Note: See TracTickets for help on using tickets.