c#重载运算符
来源:互联网 发布:大数据产品经理 编辑:程序博客网 时间:2024/05/16 00:26
public struct Point
{
public float x;
public float y;
public Point (float x, float y)
{
this.x = x;
this.y = y;
}
public Point Add (Point other)
{
return new Point (this.x + other.x, this.y + other.y);
}
public static Point Add (Point a, Point b)
{
return new Point (a.x + b.x, a.y + b.y);
}
public static Point operator + (Point a,Point b){
return new Point (a.x + b.x, a.y + b.y);
}
public static Point operator - (Point a, Point b){
return new Point (a.x - b.x, a.y - b.y);
}
public static bool operator == (Point a, Point b){
if (a.x == b.x && a.y == b.y) {
return true;
}
return false;
}
public static bool operator != (Point a, Point b){
if (a.x == b.x && a.y == b.y) {
return false;
}
return true;
}
}
0 0
- C#运算符重载
- C# - 运算符重载
- C#运算符重载
- c#运算符重载
- C# 运算符重载
- C#运算符重载
- C# 运算符重载
- C#运算符重载
- C#重载运算符
- C#运算符重载
- C#运算符重载
- C#运算符重载
- C#运算符重载
- C#运算符重载
- C#运算符重载
- C# 运算符重载
- C#运算符重载
- C#运算符重载
- 测试团队管理篇
- 通信系统中对眼图的理解(一)
- Hibernate bean 对象配制文件
- android Hook 技术剖析
- 《HeadFirst设计模式》读书笔记-第6章-命令模式
- c#重载运算符
- Permission denied (publickey). fatal: Could not read from remote repository.
- Android Studio的快捷键总结---文字图片结合
- 制作3D搜索框
- 构建高并发高可用的电商平台架构实践2
- 通信系统中对眼图的理解(二)
- Hibernate 添加数据 一 (一对多)
- 《ACM程序设计》书中题目 M
- 泛型(generic paradigm)-methods