Create a Cat
class with
one int
property: Age
. Write a program that creates a
List
of Cat
objects in a try
block. Create multiple catch
statements to handle an ArgumentOutOfRangeException
, and an
unknown exception, and a finally
block to simulate deallocating
the Cat
objects. Write test
code to throw an exception that you will catch and handle.
Modify Exercise 16-1 so that it does not throw an error.
Create a custom error type CustomCatError
that derives from
System.Exception
, and create a
handler for it. Add a method to CatManager
that checks the cat’s age,
and throws an error of type CustomCatError
if the age is less than
or equal to 0, with an appropriate message.