当前位置:网站首页>C#中运算符重载的例子
C#中运算符重载的例子
2022-06-09 20:25:00 【charlsdm】
下边举了个运算符重载的例子
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
class Point
{
public int x;
public int y;
public static Point operator +(Point p1,Point p2)
{
Point p = new Point();
p.x = p1.x + p2.x;
p.y = p1.y + p2.y;
return p;
}
}
public class TestTwo : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
Point p = new Point();
p.x = 1;
p.y = 1;
Point p2 = new Point();
p2.x = 2;
p2.y = 3;
Point p3 = p + p2;
}
}
边栏推荐
- Jerry's IO_ Key how to use double keys? [chapter]
- 华为云Stack首席架构师:打造“称手”的数字化工具,答好政企IT数字化转型这道必选题
- The HMI Software memory is abnormal, resulting in a crash exit bug
- ClickHouse 数据插入、更新与删除操作 SQL
- FPGA introduction experiment - multi key control of variable speed running light and jump light based on state machine
- shell script安装prometheus和node_exporter
- Question bank and answers for the 2022 National latest fire facility operator (senior fire facility operator) examination
- Jerry's application of camera [chapter]
- These six ways to implement load balancing technology should not be missed
- 95 ans plus tard, le programmeur de Big Factory a été condamné à neuf mois de prison pour avoir supprimé la bibliothèque.
猜你喜欢

HMI 联机下载失败的问题及解决方案

The HMI Software memory is abnormal, resulting in a crash exit bug
How to query the database with eloquent in laravel (select)

2022年GDCPC广东省大学生程序设计竞赛题解

Leetcode 1984. 學生分數的最小差值(可以,已解决)

卡尔曼滤波(KF)无迹卡尔曼滤波(UKF)

ClickHouse 数据插入、更新与删除操作 SQL

Target Segmentation -- semantic segmentation of multi category dataset by Unet

深夜小酌,50道经典SQL题,真香~

UTM转经纬度
随机推荐
ConvNets Principles
台湾再度严查陆企挖角:出动百余人次,10家企业被查,约谈近70人次!
这6种实现负载均衡技术的方式不容错过
【RK2206】4. Mqtt example
Niuke network: some sorting problems about the k-th number
Leetcode 1984. 学生分数的最小差值(可以,已解决)
Unity UI scrollbar component
Redis知识点
Odoo passed ir model. access. CSV modify other module permissions
Common regular expressions
Logback log profile add color discrimination
Personal blog system (with source code)
C#接口类的学习
Safety net interview (Miscellaneous)
HMI 软件内存异常,导致奔溃退出的bug
FPGA入门实验-基于状态机实现多按键控制变速流水灯和跳变灯
Qualcomm: it will adhere to the diversified OEM strategy and pay attention to the business cooperation conditions of Intel OEM
高通:将坚持多元化的代工战略,关注英特尔代工商务合作条件
HMI 串口屏 SD卡/TF卡升级的 bug
Unity UI slider component