C++ Program to add two complex number
Operator overloading is the process by which pre-defined symbols like “+”, “-”, “<=” gets additional meaning.
This program is used to add two complex number using operator overloading.
Int x, y;
Void getdata ()
Cout<<”\n Enter value of x and y of complex number”;
Sample operator + (sample obj)
Obj.y = x+obj.x;
Obj.y =y +obj.y;
Void display ()
Cout<<”\n Additional of two complex numbers”;
Void main ()
Sample obj1, obj2, obj3;
Obj1. Getdata ();
- Overloading Binary Operator Overloading binary operator An operator requiring two operand is called...
- C++ Program showing assignment operator overloading The symbol ‘=’ is used as Assignment operators. It is...
- C++ Program showing constructor overloading Constructor is a member function with the same name as...
- C++ Program Using Friend Function Friend function is used to access private, public and protected...
- Inline Function Inline Function The inline function is designed to speed up...