Junior OOP

What is operator overloading?

  • Defining custom behavior for operators (+, -, *, etc.) for a class.

class Point

public int X, Y;

public static Point operator +(Point a, Point b) => new Point {

X = a.X + b.X, Y = a.Y + b.Y };

More from C# Programming Tutorial

All questions for this course