Hi,
I think you should achieve the simple operator function in C#.
public struct Complex
{
public int real;
public int imaginary;
public Complex(int real, int imaginary)
{
this.real = real;
this.imaginary = imaginary;
}
public static Complex operator +(Complex c1, Complex c2)
{
return new Complex(c1.real + c2.real, c1.imaginary + c2.imaginary);
}
}
Complex num1 = new Complex(2, 3);
Complex num2 = new Complex(3, 4);
//Add two Complex objects (num1 and num2) through the overloaded plus operator:
Complex sum_Add = num1 + num2;
WRL is based on COM, I don't think we can use operator overload in COM. So that we need a named function for operator.
Best regards,
Jesse
Jesse Jiang
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.