Abstract class: - It is an incomplete class whose object cannot be created. It contains the skeleton of the method, which is implemented by derived class. The abstract class is prefixed by the keyword MustInherit. The methods with in the class are prefixed by MustOverride keyword. The derived class procedure, which implements the abstract class, is prefixed by Overrides keyword.
Program
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As New raj1
a.ravi("Rahul")
End Sub
Public MustInherit Class raj
Public MustOverride Sub ravi(ByVal s As String)
End Class
Public Class raj1
Inherits raj
Public Overrides Sub ravi(ByVal s As String)
MsgBox("Hello:" & s)
End Sub
End Class
End Class
Interface: - It is a specification of class members not the implementation of members.
It is the substitute of multiple inheritance more than one interface can be implemented by a single class. The members with in the interface are not defined. It is public by default. Variables cannot be declared within the interface. Both sub procedure and function procedure can be stored in the interface.
Program
Public
Class Form2

Join the conversation! Your thoughts help the community grow.