c++友原问题。。。
#include<iostream>using namespace std;
class Time
{
friend ostream &operator<<(ostream &output,Time &t);
friend istream &operator>>(istream &input,Time &t);
private:
int hour;
int minute;
int second;
};
ostream &operator<<(ostream &output,Time &t)
{
output<<t.hour<<"/"<<t.minute<<"/"<<t.second;
return output;
}
istream &operator>>(istream &input,Time &t)
{
input.ignore();
input>>t.hour;
input.ignore(2);
input>>t.minute;
input.ignore();
input>>t.second;
return input;
}
int main()
{
Time t;
cin>>t;
cout<<t;
}
这个代码说是没有访问权限?、、
请大虾指教一二。。。我实在不不明白了