Inheritance is achieved by using Inherits keyword in VB.NET (For C# it is :). Simple
Sample is provided in CD for understanding inheritance in folder
WindowsApplicationInheritance. There are two classes one is the parent ClsParent
and second is the child ClsChild. Parent class has a string which has to parsed for junk
data @ and /.ClsParent has the functionality which parses only cleans up
@.ClsChild then inherits from parent and adds extra functionality by parsing /.
Public Class ClsParent
Protected strData As String = jksdhkj@dadad///ajkdhsjakd
Public Function Parse() As String
Dim PstrData As String
PstrData = strData
PstrData = Replace(PstrData, @, )
Return PstrData
End Function
Public Function GetActualString() As String
Return strData
End Function
End Class
Above is the source which parses only @ of strData variable.
202
Public Class ClsChild
Inherits ClsParent
this is child and a special parse function is added which will
also parse /
Public Function ParseBackSlash()
Dim PstrData As String
PstrData = Me.Parse()
PstrData = Replace(PstrData, /, )
Return PstrData
End Function
End Class
Above is the source code for ClsChild which does the remaining work. It adds extra
functionality by parsing / junk characters of the data.