Explain how the mechanism for deciding which catch block catches an exception is like the mechanism for deciding which function definition is used when an overloaded function is called.

What will be an ideal response?


The code looks like
```
try
{// code to throw one of the several exceptions below
}
catch (int e)
{// handle the int exception
}
catch(string e)
{// handle the string exception
}
catch(MyException obj)
{// handle MyException
}

```

The mechanism for selecting the proper catch block is exactly the same as the mechanism for choosing among overloaded functions, except that the type match must be exact, or no exception will be caught. While the order of the catch blocks can affect which catch block is executed, the order does not affect the selection of a function overloading.

Computer Science & Information Technology

You might also like to view...

InventoryItem is a class that defines an item in the inventory of a warehouse. One of the fields, partNumber, is unique to each item in the inventory. partNumber is stored as an int, but it is comprised of 6 octal digits, that is, digits in the range 0 – 7 inclusive. If InventoryItem objects are sorted according to the partNumber field, what is the radix?

What will be an ideal response?

Computer Science & Information Technology

Lossy compression saves data and can reduce image quality.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

In portrait mode, when you hold a page, it is taller than it is wide, and in ________ mode, the page is wider than it is tall

Fill in the blank(s) with correct word

Computer Science & Information Technology

Which of the following means the computer automatically can configure cards like the one in the accompanying figure and other peripherals as users install them?

A. concatenation B. GIGO C. daisy chaining D. Plug and Play

Computer Science & Information Technology