Module Module1
Class Button
Public Sub New()
Console.WriteLine("in base calss")
End Sub
Public Overridable Sub Paint()
' Paint button here. '
Console.WriteLine("in base calss's paint")
End Sub
End Class
Class B1
Inherits Button
Public p As Integer = 10
Public Sub New()
Console.WriteLine("in base calss b1")
End Sub
Public Overrides Sub Paint()
' First, paint the button. '
'MyBase.Paint()
' Now, paint the banner. … '
Console.WriteLine("in base calss 2's paint")
End Sub
End Class
Class B2
Inherits B1
Dim p As Integer = 15
Public Sub New()
Console.WriteLine("in base calss last")
End Sub
Public Overrides Sub Paint()
Dim p As Integer = 5
Console.WriteLine("use of me " + Me.p.ToString) 'also mybase can be used but mostly mybase is used for static
Console.WriteLine("use of mybase" + MyBase.p.ToString)
Console.WriteLine("use of local" + p.ToString)
' First, paint the button. '
MyBase.Paint()
Console.WriteLine("in child calss's paint")
' Now, paint the banner. … '
End Sub
End Class
Public Sub main()
Dim b As New B2()
Dim str As String = "hello"
'Console.Write(Mid(str, 2))
'Console.Write(substring(str, 2))
b.Paint()
Console.Read()
End Sub
Really a nice programming blog. this blog's every post is helpful.
ReplyDeleteimemories