'Visual Basic 2010 Class of Shared Members Shared Members Namespace Excercise2 Class Rectangle Public Sub New(ByVal height As Single, ByVal width As Single) Me.Height = height Me.Width = width End Sub Private m_Height As Single Public Property Height() As Single Get Height = m_Height End Get Set(ByVal value As Single) m_Height = value End Set End Property Private m_Width As Single Public Property Width() As Single Get Width = m_Width End Get Set(ByVal value As Single) m_Width = value End Set End Property Public ReadOnly Property Area() As Double Get Area = Height * Width End Get End Property Public Function IsGreaterThan(ByVal other As Rectangle) As Boolean If Me.Area > other.Area Then IsGreaterThan = True End Function Public Shared Function Greatest(ByVal rectangle1 As Rectangle, _ ByVal rectangle2 As Rectangle) _ As Rectangle Greatest = rectangle1 If rectangle2.IsGreaterThan(rectangle1) Then Greatest = rectangle2 End Function Public Overrides Function ToString() As String ToString = Height & " by " & Width End Function End Class End Namespace 'Bezoek www.vbvoorbeelden.be voor meer Visual Basic voorbeelden. 'Copyright - De Wolf / vbvoorbeelden - 2003-2011 - Alle rechten voorbehouden.