Thank you Nicholas,
So then, the book is wrong? because it says "new in framework 2.0" instead
of "new for vb 2005"
this is exactly what is says:
For VB.NET
Public Function ToInteger() As Integer
Return Value
End Function
' Operators (new in 2.0)
Public Shared Operator +(ByVal arg1 As Cycle, ByVal arg2 As Integer) As
Cycle
arg1.Value += arg2
Return arg1
End Operator
Public Shared Operator -(ByVal arg1 As Cycle, ByVal arg2 As Integer) As
Cycle
arg1.Value -= arg2
Return arg1
End Operator
and the same for C#
//
...
public int ToInteger()
{
return Value;
}
// Operators (new in .NET 2.0)
public static Cycle operator +(Cycle arg1, int arg2)
{
arg1.Value += arg2;
return arg1;
}
public static Cycle operator -(Cycle arg1, int arg2)
{
arg1.Value -= arg2;
return arg1;
}
...
//
I just wanted to clarify this, so other readers doesn't get confused (or
fail) when the time comes to answer the exam questions.
Nicholas Paldino said:
Alexander,
C# definitely supported operator overloading from 1.0 on. I think it
is just now that VB will honor the special naming convention for
operators (I don't think that the first incarnation of VB.NET did).
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Alexander Ubillus said:
Hello,
I'm reading this book (Self-Paced for 70-536) where it says that
operators are new both to VB:NET and C#. As far as i know operators
exist for C# since 1.x and this link says so too:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/csref/html/vclrfoperator.asp
So, the book is wrong? or am i mistaking concepts?
TIA