VB.Net Program to Demonstrate the Hybrid Inheritance

You are currently viewing VB.Net Program to Demonstrate the Hybrid Inheritance

VB.Net program to demonstrate the hybrid inheritance

'VB.net program to demonstrate the hybrid inheritance.

Module Module1
    Class Sample1
        Sub Fun1()
            Console.WriteLine("Sample1.Fun1() called")
        End Sub
    End Class
    Class Sample2
        Inherits Sample1
        Sub Fun2()
            Console.WriteLine("Sample2.Fun2() called")
        End Sub
    End Class
    Class Sample3
        Inherits Sample1
        Sub Fun3()
            Console.WriteLine("Sample3.Fun3() called")
        End Sub
    End Class

    Class Sample4
        Inherits Sample3
        Sub Fun4()
            Console.WriteLine("Sample4.Fun4() called")
        End Sub
    End Class

    Sub Main()
        Dim S2 As New Sample2()
        Dim S4 As New Sample4()

        S2.Fun1()
        S2.Fun2()

        S4.Fun1()
        S4.Fun3()
        S4.Fun4()
    End Sub
    
End Module

Output

Sample1.Fun1() called
Sample2.Fun2() called
Sample1.Fun1() called
Sample3.Fun3() called
Sample4.Fun4() called
Press any key to continue . . .

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply