Confused about Exception handling
Code:
void x :: setValues (unsignedshort m_headLight) throw (OutOfRangeException)
{
try
{
if (m_headLight > 1)
{
throw OutOfRangeException (WARNINGEXP, "'m_headLight' is out of range", "Value should be either 0 or 1", __FILE__, __LINE__);
}
}
d_y.m_headLight = m_headLight;
}
The above code will work even if I remove the following statement in RED color
Code:
void x :: setValues (unsignedshort m_headLight) throw (OutOfRangeException)
Then What is the purpose of writing that statement ? Kindly explain !