IT Community - Software Programming, Web Development and Technical Support

Difference between function overloading and operator overloading

This is a discussion on Difference between function overloading and operator overloading within the C and C++ Programming forums, part of the Software Development category; Difference between function overloading and operator overloading: Function overloading is the practice of declaring the same function with different signatures. ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Software Development > C and C++ Programming

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 01-14-2008, 02:55 AM
vigneshgets vigneshgets is offline
D-Web Genius
 
Join Date: Mar 2007
Posts: 904
vigneshgets is on a distinguished road
Thumbs up Difference between function overloading and operator overloading

Difference between function overloading and operator overloading:

Function overloading is the practice of declaring the same function with different signatures. The same function name will be used with different number of parameters and parameters of different type. But overloading of functions with different return types are not allowed.

On the other hand operator overloading is:

Operating overloading allows you to pass different variable types to the same function and produce different results. In this article Ben gives us the low-down on operator overloading in C++.Operator overloading is common-place among many efficient C++ programmers. It allows you to use the same function name, but as different functions.

- Vignesh
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 03-22-2008, 01:09 AM
poornima poornima is offline
D-Web Sr.Programmer
 
Join Date: Dec 2007
Posts: 189
poornima is on a distinguished road
Smile Re: Difference between function overloading and operator overloading

Hi,
Function Overloading

In one program,u can use the same function name but with different parameters.This is known as overloading a function.

For eg;

class one
{

void show()
{
cout<<"This is from Show() function without arguments;
}
void show(int a)
{
cout<<a<<" is the argument passed to show()";
}
}

void main()
{
one o1;
o1.show();
o1.show(5);
}

In Operator Overloading,
U are going to overload only the operator not the function name.The operator is not repeated.Instead it gives different meaning..I will explain this later..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-29-2008, 02:48 AM
naina naina is offline
D-Web Trainee
 
Join Date: May 2008
Posts: 8
naina is on a distinguished road
Default Re: Difference between function overloading and operator overloading

fuction overloading:-C++ enables several functions of the same name to be defined, as long as these functions have different sets of parameters (at least as far as their types are concerned). This capability is called function overloading
Operator overloading allows existing C++ operators to be redefined so that they work on objects of user-defined classes.
__________________
Web Templetes
Web site Design
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-01-2008, 11:35 PM
getzephyr getzephyr is offline
D-Web Programmer
 
Join Date: Dec 2007
Posts: 53
getzephyr is on a distinguished road
Default Re: Difference between function overloading and operator overloading

Function overloading (also polymorphisms or method overloading) is a programming concept that allows programmers to define two or more functions with the same name.

Operator overloading is the ability to tell the compiler how to perform a certain operation when its corresponding operator is used on one or more variables.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 06-24-2008, 12:21 AM
iceman88 iceman88 is offline
D-Web Trainee
 
Join Date: Jun 2008
Posts: 4
iceman88 is on a distinguished road
Default Re: Difference between function overloading and operator overloading

Nice work guys. The function overloading had me thinking of the same thing.
It's now clearer. This is a great thread started.
Thanks to the guys.... cheers...

Software Discounts /Travel Promo Codes
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 09-18-2008, 10:54 PM
cool sam cool sam is offline
D-Web Trainee
 
Join Date: Sep 2008
Posts: 6
cool sam is on a distinguished road
Default Re: Difference between function overloading and operator overloading

Hi
Thanks guy's for this .I really confuse about this concept.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Does Python supports Function Overloading? Arun Python 2 08-14-2007 04:46 AM
What is the difference between “overloading” and “overridding”? Arun C and C++ Programming 1 07-20-2007 06:46 AM
What is the difference between “overloading” and “overridding”? prasath C and C++ Programming 2 07-17-2007 08:12 AM
Does Python supports Operator Overloading? vadivelanvaidyanathan Python 1 07-17-2007 02:10 AM
Operator overloading in C++ prasath C and C++ Programming 1 07-16-2007 05:51 AM


All times are GMT -7. The time now is 06:20 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0