H
Harlan Messinger
Since operator overloads into static functions in C#, there really doesn't
need to be a connection between the types to which the operator is being
applied and the type in which the overload is defined, does there? I mean,
there's nothing to prevent the following, right?
public class A
{
public static B operator + (C c, D d) { ... }
...
}
Seems strange, somehow.
Suppose I'm using utilities provided by several different graphics library
developers in a graphics application of mine. Suppose that two of those
developers thought that it would be clever to have
public static Bitmap operator + (Bitmap x, Bitmap y)
which returns a Bitmap that consists of the two original graphics laid out
side by side. One of them defines this in a class called MyUtilities, the
other in a class called Blech. What would happen? Would there be a
work-around?
need to be a connection between the types to which the operator is being
applied and the type in which the overload is defined, does there? I mean,
there's nothing to prevent the following, right?
public class A
{
public static B operator + (C c, D d) { ... }
...
}
Seems strange, somehow.
Suppose I'm using utilities provided by several different graphics library
developers in a graphics application of mine. Suppose that two of those
developers thought that it would be clever to have
public static Bitmap operator + (Bitmap x, Bitmap y)
which returns a Bitmap that consists of the two original graphics laid out
side by side. One of them defines this in a class called MyUtilities, the
other in a class called Blech. What would happen? Would there be a
work-around?