重载operator<<问题..标准库和vcl如何转化?ostream<
相关代码如下
错误:
friends must be functions or classes..
加入std::后,会提示未定义std:opeartor<<ansistring
#include <ostream>
#include <string>
#include <iostream>
#include <sysvari.h>
#include <vcl.h>
//---------------------------------------------------------------------------
class TTimeScope {
private:
TTime _startTime;
TTime _endTime;
protected:
public:
friend ostream& operator<< ( ostream& out, const TTimeScope& timeScope ) ;
};
//---------------------------------------------------------------------------
ostream& operator<< ( ostream& out, const TTimeScope& timeScope )
{
out << std::string(timeScope._startTime.FormatString("hh:nn").c_str()) ;
out << "至" ;
out << timeScope._endTime.FormatString("hh:nn") ;
return out ;
}