avinashk60 Profile Answers by avinashk60 Jan 19th, 2010 const ComplexNo& ComplexNo::operator+(const ComplexNo &b) { ComplexNo &result = *this; i = i + b.i; j = j + b.j; return result; };

harsha419 Profile Answers by harsha419 Questions by harsha419 Jan 21st, 2010 Addition Operator:-----------------------------------------------------Complex operator +( const Complex &temp){ Complex ctemp; ctemp.m_real = m_real+ temp.m_real; ctemp.m_imag = m_imag+temp.m_imag; cout<<" operator is overloaded"<<endl; return ctemp; //here c1+c2 by taking other temporary object "ctemp" ,c1 will not get modified.}Subtraction Operator:-----------------------------------------------------Complex operator -( const Complex &temp){ Complex ctemp; ctemp.m_real = m_real- temp.m_real; ctemp.m_imag = m_imag-temp.m_imag; cout<<" operator is overloaded"<<endl; return ctemp; //here c1+c2 by taking other temporary object "ctemp" ,c1 will not get modified.}Multiplication Operator-------------------------------------------------Complex Complex::operator *(const Complex &temp){ Complex ctemp=*this; ctemp.m_real=m_real*temp.m_real; ctemp.m_imag=m_imag*temp.m_imag; return ctemp;} and now You can go on with other operator......okkk

## Arithmetic Operations using Operator Overloading

shakthisangiProfile Answers by shakthisangi Questions by shakthisangi

Questions by shakthisangi

## Related Answered Questions

## Related Open Questions