MISRA Discussion Forums

Full Version: Rule 10-3-3 Re-declaring pure function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Rules 10-3-3 Rationale has the following description.

Re-declaring a function as pure may not meet developer expectations.

What do the developers expect?
What does it mean that it does not meet the expectations of developers?

for the example provided by this rule it means:

A a;// compile-time error: A is abstract
B b;// ok
C c;// compile-time error: C is abstract again

The last line is the one which does not meet common developer expectations when looking at the class hierarchy.
Our belief is that the developer expectation is that deriving a class adds behaviour to the base, not removes it.