C++重载运算符
摘要:
本文主要讲述加号运算符“+”,自增运算符“++”,流提取运算符运“>>”,流插入运算符"<<"的重载。先给出Vector类:class Vector
{ public: Vector(double a = 0, double b = 0) {x = a, y = b;} //构造函数 Vector(const Vector& v){x = v.x, y = v.y;} //拷贝构造函数 Vector operator + (const Vector& v); //重载+ Vector operator ++ (); ... 阅读全文
posted @ 2012-11-05 20:27 铁树银花 阅读(449) 评论(0) 推荐(1) 编辑