Professional Documents
Culture Documents
interfaces
Inheritance IN VB.NET
keyword: inherits
ABSTRACT classes are similar to base classes with the difference that the
methods declared inside the abstract classes known as abstract methods
Abstract methods do not have method body
METHOD OVERLOADING
Method Overloading allows us to write different versions of a method (i.e. a
single class can contain more than one methods (Sub / Functions) of same
name but of different implementation).
And compiler will automatically select the appropriate method based on
parameters passed
Public Overloads Function add(ByVal a As Integer, ByVal b As Integer)
Public Overloads Function add(ByVal a As Long, ByVal b As Long)
METHOD OVERRIDING
Method Overriding means override a base class method in the derived class
by creating a method with the same name and signatures to perform a
different task.
The Method Overriding in visual basic can be achieved by using
Overridable & Overrides keywords along with the inheritance principle.
Method overriding example
' Base Class
Public Class Users
Public Overridable Sub GetInfo()
Console.WriteLine("Base Class")
End Sub
End Class
'Derived Class
Public Class Details
Inherits Users
Public Overrides Sub GetInfo()
Console.WriteLine("Derived Class")
End Sub
End Class
INTERFACES