'Visual Basic 2010 Shadowing - Shadows Static Typing en Dynamic Binding Namespace FragileBaseClass2 Class CharString Private m_Items As Char() = {} Public Overridable Sub Add(ByVal aChar As Char) ReDim Preserve m_Items(m_Items.Length) m_Items(m_Items.Length - 1) = aChar End Sub Public Overridable Sub AddAll(ByVal chars As Char()) Dim oldUpperBound, newUpperBound As Integer If m_Items IsNot Nothing Then oldUpperBound = m_Items.Length - 1 If chars IsNot Nothing Then newUpperBound = _ oldUpperBound + chars.Length ReDim Preserve m_Items(newUpperBound) Dim index As Integer = oldUpperBound + 1 For Each charElement As Char In chars m_Items(index) = charElement index += 1 Next End Sub Public Overrides Function ToString() As String If m_Items IsNot Nothing Then For Each charElement As Char In m_Items ToString &= charElement Next End If End Function End Class Class CountedCharString : Inherits CharString Private m_Count As Integer Public Overrides Sub Add(ByVal aChar As Char) MyBase.Add(aChar) m_Count += 1 End Sub Public ReadOnly Property Count() As Integer Get Count = m_Count End Get End Property End Class End Namespace 'Bezoek www.vbvoorbeelden.be voor meer Visual Basic voorbeelden. 'Copyright - De Wolf / vbvoorbeelden - 2003-2011 - Alle rechten voorbehouden.