N
Nick
I have the following wrapper classed defined in a C# assembley namely:
public class wrapInt32
{
private Int32 m_Int32;
//additional object composition
public wrapInt32(){m_Int32 = 0;}
public integer Value()
{
return m_Int32;
}
//other functions
public static wrapInt32 operator +(wrapInt32 x, wrapInt32 y)
{
x.value + y.value;
return x;
}
//other overloads
}
I can consume this no problem in a parent c# application in fx version 1.1
with:
private void Form1_Load(object sender, System.EventArgs e)
{
wrapInt32 a, b, c;
a = new wrapInt32();
b = new wrapInt32();
c = new wrapInt32();
a.Value = 1;
b.Value = 2;
c = a + b;
}
BUT not in VB.NET!
Private Sub myMain()
Dim a, b, c As wrapInt32
a = New wrapInt32
b = New wrapInt32
c = New wrapInt32
a.Value = 1
b.Value = 2
c = a + b
End Sub
This produces the following error:
Operator '+' is not defined for types 'wrapInt32' and 'wrapInt32'.
Both projects reference the same assembley (first thing to check!) and
version. As far as I was aware, VB.NET could consume overloaded operators
but not create them. Am I right 'in theory' or do I have an implementation
bug to track down somewhere?
Regards
public class wrapInt32
{
private Int32 m_Int32;
//additional object composition
public wrapInt32(){m_Int32 = 0;}
public integer Value()
{
return m_Int32;
}
//other functions
public static wrapInt32 operator +(wrapInt32 x, wrapInt32 y)
{
x.value + y.value;
return x;
}
//other overloads
}
I can consume this no problem in a parent c# application in fx version 1.1
with:
private void Form1_Load(object sender, System.EventArgs e)
{
wrapInt32 a, b, c;
a = new wrapInt32();
b = new wrapInt32();
c = new wrapInt32();
a.Value = 1;
b.Value = 2;
c = a + b;
}
BUT not in VB.NET!
Private Sub myMain()
Dim a, b, c As wrapInt32
a = New wrapInt32
b = New wrapInt32
c = New wrapInt32
a.Value = 1
b.Value = 2
c = a + b
End Sub
This produces the following error:
Operator '+' is not defined for types 'wrapInt32' and 'wrapInt32'.
Both projects reference the same assembley (first thing to check!) and
version. As far as I was aware, VB.NET could consume overloaded operators
but not create them. Am I right 'in theory' or do I have an implementation
bug to track down somewhere?
Regards