运算符重载实例>>出现问题,求助帖!
#include<iostream>using namespace std;
class c
{
public:
friend ostream& operator<<(ostream& o,const c& exam);
void SetTime();
void ShowTime();
private:
int h,m,s;
};
void c::SetTime()
{
h=1;
m=2;
s=3;
}
ostream&
operator<<(ostream& o,const c& exam)
{
o<<exam.h<<':'<<exam.m<<':'<<exam.s;
return o;
}
void main()
{
c exam;
exam.SetTime();
cout<<exam<<endl;
}
//运行这个程序,出现以下内容并且一闪而消失,困惑中……:
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information found.
The thread 0x838 has exited with code 4701840 (0x47BE90).
The program 'D:\c\Debug\运算符重载实例.exe' has exited with code 4701840 (0x47BE90).