What is Operator Overloading?
C++ lets you build operators that implement unary and binary operations on objects o classes. This is called as Operator overloading. You can write a function to make the operator do your custom operation. For example:
Date dt1( 1,2, 2004);
Date dt2( 2,4, 2005);
Dt1+=100;
Int diff = dt2-dt1;
Here, the ‘+’ operator and the ‘-’ operator have been overloaded to perform custom operations for the Date class.
C++ FAQ Home