What is operator overloading? Operator overloading:- A - TopicsExpress



          

What is operator overloading? Operator overloading:- A feature in C++ that enables the redefinition of operators. This feature operates on user defined objects. All overloaded operators provides syntactic sugar for function calls that are equivalent. Without adding to / changing the fundamental language changes, operator overloading provides a pleasant façade. Example:- #include #include class complex { int a,b; public: void getvalue() { couta>>b; } complex operator+(complex ob) { complex t; t.a=a+ob.a; t.b=b+ob.b; return(t); } complex operator-(complex ob) { complex t; t.a=a-ob.a; t.b=b-ob.b; return(t); } void display() { cout
Posted on: Sun, 27 Jul 2014 12:30:01 +0000

Trending Topics



Recently Viewed Topics




© 2015