Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 10-3-3 Re-declaring pure function

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.
Posted by and on behalf of
the MISRA C++ Working Group

Forum Jump:

Users browsing this thread: 1 Guest(s)