Monday 20 August 2012

Inheritance in Vb.Net | How to use New Keyword

How to write Inheritance Program in Vb.Net using New Keyword.
Develop Logic by writing Code.
Public Class Class1
    Public a, p As Double
    Public Sub area(ByVal ra As Integer)
        a = 3.14 * ra * ra
        p = 2 * 3.14 * ra
    
    End Sub

End Class


Public Class Class2
    Inherits Class1
    Dim w As New Class1
    Dim r As Double
    Public Sub accept()
        'Console.WriteLine("enter the radius")
        'r = Console.ReadLine
        'w.area(r)
        Console.WriteLine("area=" & a)
        Console.WriteLine("perimeter=" & p)
    End Sub
End Class


Module Module1

    Sub Main()
        Dim a As Integer
        Console.WriteLine("enter the redius")
        a = Console.ReadLine()
        Dim d As New Class2
        d.area(a)
        d.accept()
        Console.ReadLine()
    End Sub

End Module
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: