Overloading is used to create multiple methods of the same name with different implementations.

learn more… | top users | synonyms

77
votes
15answers
3k views

I don't understand the arguments against operator overloading [closed]

I just read one of Joel's articles in which he says: In general, I have to admit that I’m a little bit scared of language features that hide things. When you see the code i = j * 5; … in C ...
64
votes
6answers
8k views

Why is the minus sign, '-', generally not overloaded in the same way as the plus sign?

The plus sign + is used for addition and for string concatenation, but its companion: the minus sign, -, is generally not seen for trimming of strings or some other case other than subtraction. What ...
3
votes
3answers
245 views

I want to overload a function with the same type parameter; what should I do?

I'm creating an API, and I want to overload a function for strip: QString MyClass::strip(); QString MyClass::strip(QRegularExpression open); QString MyClass::strip(QRegularExpression close); QString ...
3
votes
2answers
172 views

Can a function be polymorphic and overloaded?

In Graham Hutton's book "Programming in Haskell", he defines a function to be polymorphic, if its type "contains one or more type variables". He then defines a function to be overloaded, if its type "...
2
votes
4answers
5k views

Need help understanding reference operator(C++) in specific functions

In the current semester at the university we are working on OOP with C++. I would like to understand the difference between a pointer and a reference operator. The differences that I understand are:...
1
vote
2answers
92 views

Etymology of (function) overloading

Where does the phrase "overload" come from? It's interesting to see the translation of the term in different languages (e.g. list of Wikipedia articles about overloading), some languages translate it ...
0
votes
2answers
115 views

Could Java XYZ implement (limited) Operator Overloading without breaking backwards compatibility?

Recently, I've been learning a bit more of C++ and the dangers and uses of operator overloading, and the readability boost it provides to arithmetic types (like Complex numbers). A while ago, I was ...
0
votes
1answer
355 views

Overloading Operators - C++

I was experimenting with new overloaded operators, I have created one void operator and another one that returns something when it's called: #include <iostream> struct chichachicha{ int ...
0
votes
1answer
177 views

Overloading to support multiple related types (especially pointers)

Problem I was just trying to debug a set of file-manipulation routines I wrote for a program I am working on. One of them kept returning an INVALID_HANDLE error. Explanation I figured out what the ...