Public Class Class1 Protected a As Integer Sub New() Console.WriteLine("Inside Class1 Constructor...") Console.Write("Enter Number: ") a = CInt(Console.ReadLine()) End Sub Sub display() Console.WriteLine("a=" + a.ToString()) End Sub End Class Public Class Class2 : Inherits Class1 Protected b As Integer Sub New() Console.WriteLine() Console.WriteLine("Inside Class2 Constructor...") Console.Write("Enter Number: ") b = CInt(Console.ReadLine()) End Sub Sub disp() Console.WriteLine("b=" + b.ToString()) End Sub Sub add() Console.Write("Sum = " + (a + b).ToString()) End Sub End Class Module SumUsingDerivedClass Sub Main() Dim obj As New Class2 Console.WriteLine() obj.display() obj.disp() Console.WriteLine() obj.add() Console.ReadLine() End Sub End Module
Visual Basic dot net VB.net programming microsoft .net framework object oriented language network enabled technology visual basic 2005 IDE integrated development environment console application microsoft cre common runtime environment
Sum Using Derived Class
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment