User Id :    Password :      New Member   Forgot Password  
Topic: What is Operator Overloading?
Anamika singh
23 Nov 2010 at 12:45 AM

What is Operator Overloading?

Re: What is Operator Overloading?
Gaurav
16 Dec 2010 at 04:10 AM
Definitely every programmer who is familiar a little bit with OOP knows the meaning of overloading. In general, "overloading" means defining an additional functionality for an element (method, operator or ...). For example, look at the definition of the following class:
public class CAccount
{
     protected decimal balance;
     public CAccount()
     {
          balance = 0;
     }
     public CAccount(decimal InitialBalance)
     {
          balance = InitialBalance;
     }
}
Two definitions for CAccount constructor give the object client the chance to use the constructor with two different options.
CAccount a,b;
a = new CAccount(); //Initial balance will be 0
b = new CAccount(100); //Initial balance will be 100

Total Replies: 1
 
Featured Text Ad

Featured Ad