Copyright ã 2005 Symbian Ltd.
11
What does a panic look like?
…
…TReal PercentageToDecimal(Tint aPercentage)
… {
… ASSERT__ALWAYS(aPercentage>=0 && aPercentage <=100), Panic( EInvalidInput)
…
…TReal result = aPercentage/100;
…
… ASSERT(result>=0.0 && result<=1.0);
… return result;
}
The following is an example of  function enforcing a contract. It verifies the input and ensures that the return value lies within the range expected by the client of the code
Precondition
(triggered by e.g passing aPercentage=101)
Post condition