Saturday 7 June 2014

program 20: inheritance

program to demonstrate concept of inheritance.
-----------------------------------------code---------------------------------------------------------
Module Module1
    Class A
        Public Sub Show()
            Console.WriteLine("Calling from A")
        End Sub
    End Class

    Class B
        Inherits A
        Public Shadows Sub Show()
            Console.WriteLine("Calling from B")
        End Sub
    End Class

    Class C
        Inherits B
        Public Shadows Sub Show()
            Console.WriteLine("Calling from C")
        End Sub
    End Class
    Public Sub Main()
        Dim x As New A
        x.Show()
        x.Show()
        x.Show()
        Dim y As New B
        y.Show()
        Dim p1 As New C
        p1.Show()
        Console.ReadKey()
    End Sub
End Module
-----------------------------------------output----------------------------------------------------


umesh sohaliya
codestrew

No comments:

Post a Comment