#include <iostream>
using namespace std;
class vector2d{
public:
int x1, x2;
friend ostream& operator<<(ostream& out, vector2d& z);
vector2d( int xx1, int xx2 ){
x1 = xx1;
x2 = xx2;
};
ostream& operator<<(std::ostream& out,vector2d& z)
{
out<<""<<vector2d;
return out;
}
void wyswietl( void ){ cout << x1 << " " << x2 << endl; };
vector2d operator+( vector2d a ){ return vector2d( x1+a.x1, x2+a.x2 ); };
};
int main() {
vector2d x( 3, 1 );
vector2d y( 1, 2 );
x.wyswietl();
y.wyswietl();
vector2d z = x + y;
cout << "wektor z:" << z << endl;
}
Nie działa mi przeciazenie operatora ktos pomoże znaleść błąd?