Check out and contribute to CodePedia, the wiki for developers.
*/

Other Views

corner
*/

CPLUSPLUS FAQ - What is Operator Overloading

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
corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.
Resource Listings