Last active
January 14, 2019 17:13
-
-
Save GSoster/ce16c8f28725800f6ca924844582ca81 to your computer and use it in GitHub Desktop.
Blog Post - CSharp Operator Overloading
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Point{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace OperatorOverloading | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Point a = new Point(10, 2); | |
Point b = new Point(2, 10); | |
Point c = a + b; | |
Console.WriteLine($"Point C.X = {c.X} C.Y = {c.Y}"); // prints: Point C.X = 12 C.Y = 12 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment