[ azzpoz @ 17.11.2013. 17:57 ] @
Code: #include <iostream> using namespace std; class complex { public: double real_dio; double imag_dio; complex(double r, double i); void info(){cout<<" "<<real_dio<<" / "<<imag_dio<<endl;} }; complex::complex(double r, double i) // konstruktor { real_dio = r; imag_dio = i; } complex operator+(const complex l, const complex d) { return complex(l.real_dio + d.real_dio, l.imag_dio + d.imag_dio); } int main() { complex a(2.0, 3.0); complex b(3.0, 2.0); complex z = a + b; complex y = a.operator+(b); // ne radi!!! system("pause>0"); return 0; } Radi operacija a + b, ali zašto ne i a.operator+(b)? |