G
Guest
Hi,
I've made a class with the following operator overloads listed below.
However, If I test a 'pointer' for an instace, I get an exception that the
object is not set to an insstance of an object.
ID id = new ID(1,2)
.....
e.g. if ( id != null ) <- this line calls the static overload, I guees,
instead of testing whether the id is set to an object or not. How do I test
for an instance on id, do I have to test in another way, or are my overloads
written in a wrong way?
thanks.
public static bool operator==( ID a, ID b )
{
return ( a.no == b.no && a.rev == b.rev );
}
public static bool operator!=( ID a, ID b )
{
return ( !(a.no == b.no && a.rev == b.rev) );
}
I've made a class with the following operator overloads listed below.
However, If I test a 'pointer' for an instace, I get an exception that the
object is not set to an insstance of an object.
ID id = new ID(1,2)
.....
e.g. if ( id != null ) <- this line calls the static overload, I guees,
instead of testing whether the id is set to an object or not. How do I test
for an instance on id, do I have to test in another way, or are my overloads
written in a wrong way?
thanks.
public static bool operator==( ID a, ID b )
{
return ( a.no == b.no && a.rev == b.rev );
}
public static bool operator!=( ID a, ID b )
{
return ( !(a.no == b.no && a.rev == b.rev) );
}