Iznimke
hijerarhija iznimki
ØIznimke su klase i kao takve mogu biti nasliješene
Primjer 03
class Array
{
...
   //define the exception classes
   class xBoundary {};
   class xSize {};
   class xTooBig :   public xSize {};
   class xTooSmall : public xSize {};
   class xNegative : public xSize {};
...
};

Array::Array (int size):itsSize(size)
{
  if (size == 0 )    throw xZero();
  if (size > 30000 ) throw xTooBig();
  if (size < 1 )     throw xNegative();
  if (size < 10 )    throw xTooSmall ();

  pType = new int[size];
  for ( int i=0;i<size;i++ )
    pType[i] = 0;
}
int main()
{
   try
   {
      Array intArray(5);
      for ( int j=0;j<100;j++)
         {
             intArray[j] = j;
         }
   }
   catch ( Array::xBoundary )
   {
      // obrada1
   }
   catch ( Array::xTooBig )
   {
      // obrada2
   }
...
   catch (...)
   {
      obrada3
   }
   return 0;
}