64,662
社区成员
发帖
与我相关
我的任务
分享
class A
{
private:
int x;
public:
A(int x_ = 0):x(x_) {}
void Print(void) const
{
cout << x << endl;
}
}
std::istream& operator << (std::ostream is,const Book& rhs)
{
rhs.Print();
return os;
}
#include<iostream>
#include<string>
using namespace std;
class Book
{
private:
int x;
public:
Book(int x_ = 0):x(x_) {}
void Print(std::ostream &os) const
{
os << x << endl;
}
};
std::ostream& operator << (std::ostream &os,const Book& rhs)
{
rhs.Print(os);
return os;
};
int main()
{
return 0;
}
class A
{
private:
int x;
public:
A(int x_ = 0):x(x_) {}
void Print(std::ostream os) const
{
os << x << endl;
}
}
std::ostream& operator << (std::ostream os,const Book& rhs)
{
rhs.Print(os);
return os;
}
std::ostream& operator << (std::ostream is,const Book& rhs)
{
rhs.Print();
return os;
}