2021年9月30日
摘要: 例如: class Time { friend Time operator*(double m, const Time &t); } Time operator*(double m, const Time &t) { Time result; long tota_min = t.hours * mu 阅读全文
posted @ 2021-09-30 16:28 北京开发 阅读(35) 评论(0) 推荐(0)
摘要: 比如:A 和B 都是某种类。 只能写成: A = B * 2.75; 不能写成 A = 2.75 * B; 因为 A = B * 2.75; 将会被编译器转换为 : A = B.operator *(2.75); 阅读全文
posted @ 2021-09-30 16:14 北京开发 阅读(34) 评论(0) 推荐(0)
摘要: class Time { private: int hours; int minutes; public: Time(); Time(int h, int m = 0); void AddMin(int m); void AddHr(int h); void Reset(int h = 0, int 阅读全文
posted @ 2021-09-30 15:02 北京开发 阅读(50) 评论(0) 推荐(0)