Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is the use of Operator Overloading?



What is the use of Operator Overloading?..

Answer / ben jacob

Operator Overloading helps users/developers use a particular
class in an intuitive manner for different kind of
operations logically possible on the class.
It's used for ease of code read and maintainability.

e.g. Date 'b' can be subtracted from another instance of
Date, say 'a', to get the difference in number of days
between the two days.
So, you would overload the subtraction operator '-' for the
Date class accordingly.
Date a("07/04/2008);
Date b("05/04/2008);

//operator overoading for '-' for Date
//returns number of days
int Date::operator-(const Date& rhsDate)
{
//wotever logic
return <number of days between the (this) date and rhsDate>
}

Is This Answer Correct ?    5 Yes 0 No

Post New Answer

More OOAD Interview Questions

Explain about inheritance in oops?

0 Answers  


What is a subclass?

0 Answers  


Differences between functional programming and object-oriented programming?

0 Answers  


Explain the abstract class modifier?

0 Answers  


Difference: Object Oriented Analysis (OOA) and Object Oriented Design (OOD)?

5 Answers   ABC, Protech,


What is the @functionalinterface annotation?

0 Answers  


What does the “abstract” keyword mean in front of a method? A class?

0 Answers  


Why does the function arguments are called as "signatures"?

4 Answers  


How to make a class accessible as a web service?

0 Answers   BirlaSoft,


Do structs support inheritance?

0 Answers  


State two differences between an object and a class.

0 Answers   DELL,


What is the syntax of object oriented method call?

0 Answers  


Categories