Posted by: Sourav | August 20, 2016

Interface and multiple Inheritance example in VB,Visual Basic Teacher Sourav


Option Strict On
Option Explicit On
Imports System
Interface Iparentcustomer
Sub Iparentcustomer()
End Interface
Interface Icustomer1
Inherits Iparentcustomer
Sub Icustomer1()
End Interface
Interface Icustomer2
Inherits Iparentcustomer
Sub Icustomer2()
End Interface
Class intfclass
Implements Icustomer1, Icustomer2

Sub Icustomer1() Implements Icustomer1.Icustomer1
Console.WriteLine(“Hello I am interface Icustomer1”)

End Sub
Sub Icustomer2() Implements Icustomer2.Icustomer2
Console.WriteLine(“Hello I am interface Icustomer2”)

End Sub
Sub Iparentcustomer() Implements Icustomer1.Iparentcustomer
Console.WriteLine(“Hello I am interface Iparentcustomer of Icustomer1”)

End Sub
End Class

Module Module1

Sub Main()
‘Dim intf1 As intfclass = New intfclass
‘ Dim intfref As Iparentcustomer = New intfclass
‘intfref.Iparentcustomer()
Dim intfref As Icustomer1 = New intfclass
intfref.Iparentcustomer()
intfref.Icustomer1()

‘intf1.Icustomer1()
‘intf1.Icustomer2()
‘intf1.Iparentcustomer()
‘ Dim intfref As Icustomer2 = New intfclass
‘intfref.Icustomer2()
‘intfref.Iparentcustomer()

Console.ReadLine()

End Sub

End Module

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: