Assignmebnt No. – 04
Program on Innterface :-
Module IntefaceExamplekb
Sub Main()
Dim obj As New Class2
obj.add()
obj.pro()
Console.ReadLine()
End Sub
End Module
Interface in1
Sub add()
End Interface
Interface in2
Sub pro()
End Interface
Interface in3
Inherits in1, in2
End Interface
Public Class Class2 : Implements in3
Public Sub add() Implements in1.add
Console.WriteLine("Add Function...")
End Sub
Public Sub pro() Implements in2.pro
Console.WriteLine("Product Function...")
End Sub
End Class
Output :-
Program on Exception Handling :-
Module ExecptionHandlingExamplekb
Sub Main()
Dim a, b, c As Integer
Console.Write("Enter a and b :")
a = CInt(Console.ReadLine)
b = CInt(Console.ReadLine)
Console.WriteLine("a = " + a.ToString())
Console.WriteLine("b = " + b.ToString())
Console.WriteLine()
Try
c = a \ b
Console.WriteLine("c = " + c.ToString())
Catch ex As Exception
Console.WriteLine("Exception occured: " + ex.Message())
End Try
Console.ReadLine()
End Sub
End Module
Output :-