123456789101112131415161718
class complex { private: double Re, Im; /*...*/ public: void multiply(complex that); /*...*/ }; void complex::multiply(complex that) { Re = Re * that.Re - Im * that.Im; Im = Im * that.re + Re * that.Im; } /* usage */ complex x(1, 2), y(3, 4); x.multiply(y);