Most voted "overload" questions
Overloading an operator means resetting its symbol, so that it also applies to user-defined data types such as classes and structures.
Learn more…37 questions
Sort by count of
-
14
votes1
answer5228
viewsWhat are the differences between overrideing and overloading in Java?
What are the main differences between overrideing and overloading in Java? What is the relationship between these terms and Polymorphism?
-
12
votes2
answers5497
viewsHow to perform method overload with PHP?
How to perform method overload with PHP? To declare methods with the same name but with different parameters.
-
12
votes4
answers229
viewsIs overloading methods less performatic?
I was reading about interfaces as part of my studies and came across an overloaded class (overloading) methods, with two comments saying that it should be avoided. I was in doubt about it affecting…
-
11
votes3
answers5893
viewsWhat is operator overload?
In some programming languages such as C++ it is possible to overload operators. What is and what serves?
-
9
votes3
answers2573
viewsHow to use constructor overload in Typescript?
In languages with C#, for example, it is possible to use constructor overload as shown below: public class Teste{ public Teste(bool a, int b, string c){ } public Teste(bool a, int b){ } public…
-
6
votes1
answer283
views -
6
votes2
answers3155
viewsHow does Python overload polymorphism work?
I recently learned POO in Java and am now learning in Python. There is overload polymorphism (implement methods with equal names in the same class, which depending on the parameters you deliver to…
-
5
votes3
answers1022
viewsYou’re a builder, right?
I’d like to understand why this class has two builders and why one of them has everything in it this and not separated as in the other. This changes something? Normal builder: public…
-
4
votes1
answer1006
viewsOverload method is polymorphism?
I’m having trouble understanding the concept of polymorphism in Java, I read two articles of the same portal now and I was more confused, because for my interpretation they contradict each other:…
-
4
votes2
answers64
viewsIs it possible to perform an overload (Overload) with Arrow functions?
I have a function where the return type depends on the parameter type. I was able to declare this overload with function, but not with Arrow Function, because I get the error: Cannot redeclare…
-
3
votes3
answers1140
viewsMethods with the same name but with a number of different parameters
In C# or Java in a class I can define methods with the same name but with different variables, like this: //em C# public class Classe { public String teste(String hello, String world){ return hello…
-
3
votes1
answer100
views -
2
votes1
answer832
viewsHow to run the same php script via cron without overloading?
What is the best way to run the same php script several times by making random queries for a given column with a limit of 1000 per query of the same mysql table via cron (Cpanel) without generating…
-
2
votes2
answers607
viewsIs it possible somehow to overload functions in C?
I’m already programming in C, in a procedural way, but a few months ago I started programming oriented to objects. In Java, it is possible to overload functions. Since Java is an object-oriented…
-
2
votes2
answers566
viewsHow to implement operator overload << and >> in C++?
Hello, I’m doing an exercise consisting of the following statement: Sorry to put a print, but I could not select the text and it would be unnecessary to type everything here. Finally, I made the…
-
2
votes2
answers143
viewsOverload of C++ operators, is the auxiliary variable necessary in this case?
I am studying for the book Introduction to Object-Oriented Programming with C++ (Antonio Mendes da Silva Filho), and implemented an example of it as follows: #include <iostream> using…
-
2
votes1
answer255
viewsOperator overload in C#
I have some questions about overloading operators in C#. What good is? His concept is the same as Overload in Java methods? Is there any practical example of doing such a procedure on a day-to-day…
-
2
votes1
answer64
viewsHow to declare a boolean Operator()?
I understand what it does and its usefulness, however, during the researches I did found contradictory information regarding the syntax of a boolean operator. I found 2 syntaxes: bool operator()…
-
2
votes1
answer160
viewsHow does operator overload work?
How this code works? class MyClass: def __init__(self, *args): self.Input = args def __add__(self, Other): Output = MyClass() Output.Input = self.Input + Other.Input return Output def __str__(self):…
-
1
votes2
answers283
views -
1
votes3
answers209
viewsCan the "main()" method be overwritten or overwritten?
I read the answer What public Static void main(String[] args means)?, but I still have two doubts about the method main(): The method main() can be overloaded? The method main() may be…
-
1
votes1
answer83
views -
1
votes1
answer90
viewsOperator overload = in c++
I’m having a problem implementing operator overload = in a heap class. Heap& Heap::operator=(const Heap& outro){ printf("chamei atribuição\n"); this->escreve(); Heap *h = new Heap(outro);…
-
1
votes2
answers71
viewsIs it possible to overload Javascript mathematical operators for objects?
I wanted to know how we can overload the subtraction operator, so that when the object is subtracted by another equal object, it returns a new object, with everything subtracted Example: var player…
-
1
votes1
answer52
viewsHow to copy the summary of a method with Overload in C#
I’m creating an application where in the classes I have a series of Overload's to optimise its performance and flexibility. Ex: public class Calc { // método original com sumário /// <summary>…
-
1
votes1
answer68
viewsHow not to repeat the same code on an overload?
What would be correct technique not to repeat the same code for these two overloads or maybe not to have the overloads? It happens that sometimes I have to pass a parameter that is a string array…
-
1
votes1
answer89
viewsMethod overload in C#
I am learning about overload methods in C# and would like to create a simple program that reads a user’s age and name, but would like to create two methods with the same name (overload) where…
-
0
votes1
answer155
viewsLoad operator "<<" by separating the declaration(.h) from the definition(.cpp)
I’m trying to separate the definition of the class implementation into separate files, but I’m getting Undefined Ference on the operator <<. What I’ve already tried: Change the order of…
-
0
votes1
answer455
viewsOperator overload ==
bool Stock::operator== (const Stock& stk){ if ( this->get_resource() == (stk.get_resource()) ) return true; else return false; } I created this method to overload the operations of a class,…
-
0
votes1
answer64
viewsHow to create PHP overload via variadic-Function?
This is my problem : for the sake of debug I decided to create a function that would return me a print_r formatted without the need for a gambiarra (that is, without creating the…
-
0
votes1
answer196
viewsHow to Overload a constructor and also call the base class constructor in C#?
I am creating a C# error that should extend the class Exception but, should also add an extra property, thus: public class CampoVazioErro: Exception { public string campo { get; } public…
-
0
votes2
answers70
viewsIs it better to use overloading or add an "if" with the optional parameter?
I have a method in which an attribute may not be used In this case if the value passed is not empty it adds the parameter to my email public async Task<bool> SendEmail(string to, string…
-
0
votes1
answer38
viewsVariable is not found in an operator method
I’m studying operator overload but my code is not compiling. #include <iostream> using namespace std; class Complexo { public: int real, image; Complexo(); Complexo(int r, int i); Complexo…
-
0
votes1
answer392
viewsError Dispose(bool)': no suitable method found to override C#
I’ve checked on other forums and even here, but that’s it correct with the class name o namespace is the same. He caused me other mistakes besides this, but this I believe is the main one that is…
-
-1
votes1
answer54
viewsDoesn’t Arraylist accept Overload Polymorphism?
I am trying to overload the add method, but apparently this does not work with Arraylists. Confirm? Métodos: public int somar(ArrayList <Classe> classe){...} public int…
-
-2
votes2
answers441
viewsError 1 No Overload for method 'Inherited method' takes 1 Arguments
Error 1 No Overload for method 'Inherited method' takes 1 Arguments Code: public void restauraRegistro(DataGridViewRow linha) { try { string codigo = String.Empty; //verifica se e para recuperar com…
-
-3
votes3
answers238
viewsError while trying to overload Operators with dates
I’m trying to overload operators for dates, but if I use a double overload it gives error. What I actually want to do is that if the user uses a separator defining a format he accepts and if the…