when we overloading a function: what matters is only the argument list(inclued the types) or the return type too?
i'm overloading the assigment operator, but seems that i can't use with diferent return types:(
please someone explain to me
cambalinho
125
Practically a Posting Shark
Recommended Answers
Jump to Postyou need to have the return type specified as well
Jump to Postit depends on what you're overloading, if its operators then the return type must match to what the data is being assigned to or the operator type. with normal functions then the return type can also be different as long as the paremeters are also different (i think).
assuming you're …
Jump to PostOverloading (of function or operators) is done only with the parameters, not the return type. If you have two function with the same name (or operator), same parameters and a different return type, the compiler is going to say that the call is ambiguous (it cannot choose between the two …
All 10 Replies
Slavi
94
Master Poster
Featured Poster
A Haunted Army
0
Light Poster
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
cambalinho
125
Practically a Posting Shark
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
cambalinho
125
Practically a Posting Shark
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
cambalinho
125
Practically a Posting Shark
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
cambalinho
125
Practically a Posting Shark
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.