Imports System
Module HelloWorld
Public Sub Main()
Try
Dim big_discount as new Discount(56)
Catch ex as Exception
Console.WriteLine(ex.Message)
End Try
End Sub
End Module
Public Class Discount
Private percent as Integer
Public Sub New(ByVal percent as Integer)
Me.percent = percent
If (percent > 50) Then
Throw New MyException("Discount > 50%")
End If
End Sub
End Class
Public Class MyException
Inherits Exception
Public Sub New(ByVal msg as String)
MyBase.New(msg)
End Sub
End Class
|