MISRA Discussion Forums
Rule 10-3-3 Re-declaring pure function - Printable Version

+- MISRA Discussion Forums (https://forum.misra.org.uk)
+-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18)
+--- Forum: MISRA C++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19)
+---- Forum: 6.10 Derived classes (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=139)
+---- Thread: Rule 10-3-3 Re-declaring pure function (/showthread.php?tid=1467)



Rule 10-3-3 Re-declaring pure function - nishiyama - 05-02-2019

Hi.

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?


Re: Rule 10-3-3 Re-declaring pure function - dg1980 - 08-02-2019

Hi,

for the example provided by this rule it means:

Code:
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.


Re: Rule 10-3-3 Re-declaring pure function - misra cpp - 10-04-2019

Our belief is that the developer expectation is that deriving a class adds behaviour to the base, not removes it.