首页 > 其他 > 详细

重载Point

时间:2015-04-02 20:32:16      阅读:170      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!