Public Class Class1 Dim a, b As Integer Sub New() Console.Write("Enter 1st number : ") a = CInt(Console.ReadLine()) Console.Write("Enter 2nd number : ") b = CInt(Console.ReadLine()) End Sub Sub add() Dim c As Integer c = a + b Console.WriteLine() Console.WriteLine("Sum = " + c.ToString()) End Sub End Class Module SumUsingClass Sub Main() Dim obj As New Class1 obj.add() Console.ReadLine() End Sub End Module
No comments:
Post a Comment