Page 1 of 1

Rule 10-3-3 Re-declaring pure function

Posted: Tue Feb 05, 2019 3:57 am
by nishiyama
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

Posted: Fri Feb 08, 2019 7:17 am
by dg1980
Hi,

for the example provided by this rule it means:

Code: Select all

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

Posted: Wed Apr 10, 2019 2:53 pm
by misra cpp
Our belief is that the developer expectation is that deriving a class adds behaviour to the base, not removes it.