JaedenRuiner
Well-known member
- Joined
- Aug 13, 2007
- Messages
- 340
- Programming Experience
- 10+
Okay, this is all code, so i'll just give it flat out:
The Ancestor Class:
The Descendant Class:
On the Marked Line I get this error from the compilter (VS.NET 2005)
Why is the parameter on the stack able to perform the assignment operation while the Class Property cannot?
Thanks
Jaeden "Sifo Dyas" al'Raec Ruiner
VB.NET:
Public Structure Coordinates
Private f_Row As Integer
Private f_Col As Integer
Shared Operator <>(ByVal C As Coordinates, ByVal value As Integer) As Boolean
Return CBool((C.f_Col * C.f_Row) <> value)
End Operator
Shared Operator =(ByVal C As Coordinates, ByVal value As Integer) As Boolean
Return CBool((C.f_Col * C.f_Row) = value)
End Operator
Shared Operator <>(ByVal C1 As Coordinates, ByVal C2 As Coordinates) As Boolean
Return CBool((C1.f_Col <> C2.f_Col) OrElse (C1.f_Row <> C2.f_Row))
End Operator
Shared Operator =(ByVal C1 As Coordinates, ByVal C2 As Coordinates) As Boolean
Return CBool((C1.f_Col = C2.f_Col) AndAlso (C1.f_Row = C2.f_Row))
End Operator
Public Property Row() As Integer
Get
Return f_Row
End Get
Set(ByVal value As Integer)
f_Row = value
End Set
End Property
Public Property Column() As Integer
Get
Return f_Col
End Get
Set(ByVal value As Integer)
f_Col = value
End Set
End Property
Public Sub New(ByVal iRow As Integer, ByVal iCol As Integer)
f_Row = iRow
f_Col = iCol
End Sub
End Structure
VB.NET:
public mustinherit class MyClass1
Protected MustOverride Sub SetDimensions(ByVal Size As Coordinates)
Private f_Extents As Coordinates = New Coordinates(0, 0)
Protected Property Size() As Coordinates
Get
Return f_Extents
End Get
Set(ByVal value As Coordinates)
f_Extents = value
End Set
End Property
end class
VB.NET:
Public Class MyClass2
Inherits MyClass1
Protected Overrides Sub SetDimensions(ByVal rSize As Coordinates)
If rSize = 0 Then
If rSize.Row = 0 Then rSize.Row += 1
If rSize.Column = 0 Then rSize.Column += 1
End If
If Compare(rSize, Me.Size) = 0 Then Exit Sub
If Compare(rSize, Me.Size) > 0 Then
While Me.Size.Column < rSize.Column
AddColumn()
>>> Me.Size.Column += 1 <<<<<
End While
Else
End If
Me.Size = Size
End Sub
Error 9 Expression is a value and therefore cannot be the target of an assignment.
Why is the parameter on the stack able to perform the assignment operation while the Class Property cannot?
Thanks
Jaeden "Sifo Dyas" al'Raec Ruiner