重载操作符《

来源:互联网 发布:c语言register变量 编辑:程序博客网 时间:2024/05/21 21:39

ostream& operator<<(ostream& os,Time& t)

{

        os<<t.hour<<"hours,"<<t.minute<<"minutes";

        return os;

}

 

因为经常出现这种情况: cout<<"The time is:"<<time<<endl;

                                返回ostream对象的引用

原创粉丝点击