码迷,mamicode.com
首页 > 其他好文 > 详细

重载Point

时间:2015-04-02 20:33:02      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:

重载Point

其中减法表示向量,乘法表示叉积

技术分享
struct Point
{
    double x,y;
    friend double operator*(const Point A,const Point B)
    {
        return A.x*B.y-A.y*B.x;
    }
    friend Point operator-(const Point A,const Point B)
    {
        return {A.x-B.x,A.y-B.y};
    }
};
View Code

 

重载Point

标签:

原文地址:http://www.cnblogs.com/--560/p/4387905.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!