9
Reply

Problem with overloading operator+

Ask a question
Majid Kamali

Majid Kamali

14y
4.3k
1
Hello.
I wrote the code below:
 public static Point operator +(Point p1, Point p2)
{
return new Point(p1.X + p2.X, p1.Y + p2.Y);
}
But Creates error below on "operator+" :
One of the parameters of a binary operator must be the containing type

What's the problem?

Thanks.

Answers (9)