Create a user defined class for Exception for age, if age is negative throw an exception that age cannot be less than zero?
using System;
using System.Collections.Generic;
namespace App
{
class AgeException:Exception{
public AgeException()
: base("Age cannot be less than zero")
{
}
}
class Program
{
static void Main(string[] args)
{
Console.ReadLine();
}
}
}
Comments
Leave a comment