Option Strict On
Imports System
Public Class Rectangle
Public Sub New(ByVal top As Integer, ByVal left As Integer)
Me.top = top
Me.left = left
End Sub
Public Sub DrawRectangle( )
Console.WriteLine("Drawing Rectangle at {0}, {1}", top, left)
End Sub
Private top As Integer
Private left As Integer
End Class
Public Class NamedRectangle
Inherits Rectangle
Public Sub New(ByVal top As Integer, ByVal left As Integer, ByVal n As String)
MyBase.New(top, left)
RectName = n
End Sub 'New
Public Shadows Sub DrawRectangle( )
MyBase.DrawRectangle( )
Console.WriteLine("Writing string to the listbox: {0}", RectName)
End Sub
Private RectName As String
End Class
Module Module1
Sub Main( )
Dim w As New Rectangle(5, 10)
w.DrawRectangle( )
Dim lb As New NamedRectangle(20, 30, "Hello")
lb.DrawRectangle( )
End Sub
End Module
Drawing Rectangle at 5, 10
Drawing Rectangle at 20, 30
Writing string to the listbox: Hello