#include<iostream> using namespace std; class A { public: A(int x, int y){rx = x;ry = y;} int rx; int ry; }; ostream&operator<<(ostream&s,A&a) { s<<a.rx; s<<a.ry; return s; } int main() { A a(1,2),b(3,4); cout<<a<<endl; cout<<b<<endl; return 0; }
#include<iostream> using namespace std; class A { public: A(int x, int y){rx = x;ry = y;} friend ostream&operator<<(ostream&s,A&a) { s<<a.rx; s<<a.ry; return s; } int rx; int ry;
}; int main() { A a(1,2),b(3,4); cout<<a<<endl; cout<<b<<endl; return 0; }