It is a collection of members without any definitions.
Interface <interface Name>
“Member(s) without definition
- - - - - -
End interface
The members of the interface are by default “public” and hence the members present within the interface should not be defined using any modifier.
To use the members of the interface, it is mandatory to implement the interface using the class.
Class <class Name> implements interface Name(s)
Member(s)
- - - - - - -
End interface
Inclined to build a profession as VB.Net Developer? Then here is the blog post on, explore VB.Net Training
Modifier sub-method name ([arginfo]) implements
InterfaceName.memberName
Statement(s)
- - - - - - - -
End sub
(Multiple Inheritances is possible in JAVA & in JAVA JNH & implementation is same)
But VB.Net people think JNH & implements are different
JNH à Means taking the members & property of the parent
Ex: Parents property to the child if 3 Assets
JMP à Means giving the def for members
Ex: Parents loan clearing by a child.
‘‘Demo on Interface
Imports system
Module Interface ‘‘Demo1
Interface I Father
Sub My Property ( )
End Interface
Interface I Mother
Sub My Property ( )
End Interface
Class Child
Implements I Father, I Mother
Public sub-My Property ( )
Implements I Father.My Property, I Mother.My Property ( )
Console.WriteLine (“Use property for business and charity”)
End sub
End Class
Sub main ( )
Dim C as Child
C.My Property ( )
End sub
End Module
‘‘Demo on Interface
Imports system
Module Interface ‘‘Demo2
Interface I Father
Sub My Property ( )
End Interface
Interface I Mother
Sub My Property ( )
End Interface
Class Child
Implements I Father, I Mother
Public sub-Father Property ( )
Implements I Father.My Property
Console.WriteLine (“Use property for business”)
End sub
Public sub-Mother Property ( )
Implements I Mother.My Property
Console.WriteLine (“Use property for charity”)
End sub
End Class
Sub main (
Dim C as New Child
C.Father Property ( )
C.Mother Property ( )
End sub
End Module
It is a class with a collection of members without any definitions.
Must Inherit class <class Name>
Member(s)
- - - - - - -
End class
Objects can’t be defined for Must Inherit class To use the members of the Must inherit class it must be inherited by the other class and derived class should define members not defined within the must inherit class
Dim C as New abstract class () gives error ‘.’ We can’t create an object for must inherit a class
‘‘Demo on MustInherit Class
Imports system
Module MustInherit Class ‘‘Demo
MustInherit Class Abstract Class
Public sub Method Defined ()
Console.WriteLine (“Method Defined at Abstract Class”)
End sub
Public MustOverride sub
Method Undefined ()
End Class
Class Derived Class
Inherits Abstract Class
Public Overrides sub
Method Undefined ()
Console.WriteLine (“Method Defined at Abstract Class”)
End sub
End Class
Sub main ( )
Dim ac as New Abstract Class //error
Dim dc as new Derived Class
dc.MethodDefined ( )
dc.MethodUnDefined ( )
End sub
End Module
Not Inheritable Class:
It is used to define a class as the last class in the hierarchy of inheritance. i.e.; NotInheritable class can’t be inherited further.
A NotInheritable class can inherit other class and can implement any no. of inheritances and objects can also be defined for the class.
Ex:
‘‘Demo on NotInheritable Class
Imports system
Module NotInheritable Class ‘‘Demo
Interface I Face
Sub My Method ()
End interface
Class BaseClass
Public sub says ()
Console.WriteLine (End of VB.Net Fundamentals”)
End sub
End Class
NotInheritable class FinalClass
Inherits BaseClass
Implements I Face
Public sub-MyMethod () Implements IFace.MyMethod
Console.Write (“MyMethod says”)
End sub
End class
Sub main ()
Dim fc as New FinalClass
fc.MyMethod ()
fc.says ()
End sub
End Module
You liked the article?
Like: 0
Vote for difficulty
Current difficulty (Avg): Medium
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.