Skip to main content

Questions tagged [method-overloading]

0 votes
1 answer
132 views

In a Java Spring API, I'm implementing GeoJson Conversion Service to convert different types to geojson, I have GeoJsonConversionService interface, and one implementation is ...
zaydoosh's user avatar
  • 103
6 votes
1 answer
366 views

The CppCoreGuidelines contain the following: T.65: Use tag dispatch to provide alternative implementations of a function [...] Example struct pod_tag {}; struct non_pod_tag {}; template<class T&...
Jan Schultke's user avatar
1 vote
1 answer
779 views

If I have a discriminated union and want to write a function piecewise, the following code works just fine, but is taking advantage of some fairly tricky (at least to me) stuff involving overload ...
Daniel McLaury's user avatar
0 votes
3 answers
403 views

I have various types of financial securities. Each one of these securities shares a common set of methods. For instance, they all pay some amount of cash interest between two dates. Each security has ...
cpage's user avatar
  • 57
0 votes
1 answer
137 views

Suppose I have a program.c that needs element_123 to do some operations, and element_123 can be accessed by including agent.h /*program.c*/ #include "agent.h" uint32_t element_123 = 0; ...
Andy Lin's user avatar
  • 185
1 vote
1 answer
101 views

Edited Question based on the comments and great feedback (thanks) I have a REST controller exposing two GET endpoints. GetById - taking a single id (string) GetById - taking multiple id's (a ...
lucniner's user avatar
1 vote
3 answers
156 views

I'll demonstrate with an example of the normal distribution in Python. def norm_pdf(x, mu=0, v=1, p=1): """Returns un-normalized probability density of normal distribution at x. mu: mean v: ...
chausies's user avatar
  • 165
2 votes
3 answers
1k views

I am writing a program that describes different properties on a single Management Company's plot of land. For this program there are 3 overloaded addProperty method's. My question is I can reuse the ...
Alec Felix's user avatar
1 vote
1 answer
2k views

I would like to know if it is allowed in the UML to specify a different return type for overloaded operations. This is possible for methods in Java: public class C { public int addOne(int a) { ...
xoric's user avatar
  • 51
-1 votes
2 answers
143 views

Usually method overloads delegate their parameters to the more detailed overloads with default values. here is an example A(x) => A(x, null); A(x, y) => A(x, y, null); A(x, y, z) => ...; ...
M.kazem Akhgary's user avatar
36 votes
5 answers
7k views

Is it enough for methods to be distinguished just by argument name (not type) or is it better to name it more explicitly? For example T Find<T>(int id) vs T FindById<T>(int id). Is there ...
Konrad's user avatar
  • 1,569
2 votes
0 answers
506 views

I am currently developing on a small library allowing to read and write Java .properties files while retaining all the formatting (comments, whitespace, etc.): https://github.com/hupfdule/apron This ...
radlan's user avatar
  • 129
3 votes
1 answer
38 views

So I have a function in our application's Business Edits assembly (which references the Data Access assembly) which I've found a need to use in the Data Access assembly. I like the idea of keeping ...
j.i.h.'s user avatar
  • 141
2 votes
1 answer
1k views

It is generally agreed that overloading a method should not change its behavior, but how much of a method's behavior should be kept consistent? Take for example a REST API client which is responsible ...
IAmHereToParticipate's user avatar
1 vote
2 answers
252 views

I'm creating an interface to record navigation history. First thing is, we have three types of records: Recordable (the default behaviour), Revisitable (a user can look at their history and revisit ...
HorusKol's user avatar
  • 4,161

15 30 50 per page