#include <iostream>
using namespace std;
class Test
{
int x, y;
public:
Test() : x(0), y(0) {}
friend void operator << (ostream& out, Test test);
};
void operator << (ostream& out, Test test)
{
out << "overloaded operator <<" << endl;
out << "x = " << test.x << endl;
out << "y = " << test.y << endl;
}
int main()
{
Test test;
cout << test;
}
No comments:
Post a Comment