Saturday 7 June 2014

program 21: base class construction

program to demonstrate concept of base class construction.

-----------------------------------------code---------------------------------------------------------
Imports System.Console
Module Module1

    Sub Main()
        Dim w As New window(10, 5)
        w.drawwindow()
        Dim lb As New listbox(20, 30, "hello..!!")
        lb.drawwindow()
        Console.ReadKey()
    End Sub

End Module
Public Class window
    Private top As Integer
    Private left As Integer
    Public Sub New(ByVal top As Integer, ByVal left As Integer)
        Me.top = top
        Me.left = left
    End Sub
    Public Sub drawwindow()
        WriteLine("Drawing window at {0},{1}", top, left)
    End Sub
End Class
Public Class listbox
    Inherits window
    Public Sub New(ByVal top As Integer, ByVal left As Integer, ByVal tcontent As String)
        MyBase.New(top, left)
        mlstboxcontent = tcontent
    End Sub

    Public Shadows Sub drawwindow()
        Console.WriteLine("..........")
        MyBase.drawwindow()
        Console.WriteLine("Writing string to the listbox:{0}", mlstboxcontent)
    End Sub
    Private mlstboxcontent As String
End Class
-----------------------------------------output----------------------------------------------------


umesh sohaliya
codestrew

No comments:

Post a Comment