摘要:
该函数为友元函数 不然是 time<<cout ostream & operator<<(ostream & os,const Time &t) { os<<XX<<' '<<YY; return os; } 在这里 return os是为了可以连贯的cout (cout<<1)<<Time; 重载 阅读全文
posted @ 2021-06-19 21:33
旅玖旅玖
阅读(45)
评论(0)
推荐(0)
摘要:
每个成员函数都有一个this指向调用对象(this是个指针) 例 比较两个类大小 { if(a>b) return stock if(a<b) return *this } 阅读全文
posted @ 2021-06-19 20:16
旅玖旅玖
阅读(27)
评论(0)
推荐(0)
摘要:
template <typename AnyType> void Swap(AnyType &a,AnyType &b)// AnyType *a是数组 { AnyType temp; temp=a; a=b; b=temp; } template<> void Swap<typename>(str 阅读全文
posted @ 2021-06-19 13:30
旅玖旅玖
阅读(22)
评论(0)
推荐(0)