Demonstration of Extending a class

Module Module1
    ' MCTS70-536/1/1/3
    ' Extending an existing class
  
    ''' <summary>
    ''' A simple base class
    ''' </summary>
    ''' <remarks></remarks>
    Public Class Customer
  
        Private _naam As String
        Private _adres As String
        Private _woonplaats As String
  
        Public Property Naam() As String
            Get
                Return _naam
            End Get
            Set(ByVal value As String)
                _naam = value
            End Set
        End Property
  
        Public Property Adres() As String
            Get
                Return _adres
            End Get
            Set(ByVal value As String)
                _adres = value
            End Set
        End Property
  
        Public Property Woonplaats() As String
            Get
                Return _woonplaats
            End Get
            Set(ByVal value As String)
                _woonplaats = value
            End Set
        End Property
  
    End Class
  
    ''' <summary>
    ''' The XCustomer INHERITS and extends the Base Customer Class
    ''' </summary>
    ''' <remarks></remarks>
    Public Class XCustomer
  
        Inherits Customer
  
        Private _huisnummer As Integer
  
        Public Property Huisnummer() As Integer
            Get
                Return _huisnummer
            End Get
            Set(ByVal value As Integer)
                _huisnummer = value
            End Set
        End Property
  
        ' --- Override the ToString method
        Public Overrides Function ToString() As String
            Return Me.Naam &amp;amp;amp; ":" &amp;amp;amp; Me.Adres &amp;amp;amp; ":" &amp;amp;amp; Me.Huisnummer &amp;amp;amp; ":" &amp;amp;amp; Me.Woonplaats
        End Function
  
    End Class
  
    Sub Main()
  
        '  Our XCustomer object has ALL properties from the base class, and the extension
        '  we made. Additionaly, the .ToString method now returns all data embedded in the class
        Dim x As New XCustomer
        x.Naam = "piet"
        x.Huisnummer = 10
  
        Console.WriteLine(x.ToString)
  
        Console.Write(" >>")
        Console.ReadLine()
  
    End Sub
  
End