The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [overloading]

The terms overloading and overloaded may refer to: - Constructor and method overloading, a type of polymorphism where different functions with the same name are invoked based on the data types and number of the parameters passed - Operator overloading, a form of functional or method overloading where the action being overloaded is an operator, such as + or -

Filter by
Sorted by
Tagged with
2
votes
2answers
783 views

Grails overloaded controller workaround

I had an overloaded method, but Grails doesn't allow overloaded methods in controller actions. The overloaded method looked like this: ...
2
votes
1answer
96 views

C++ - Astar search algorithm using user defined class

The objective of the post is to improve design and improve command on C++. Given a map, start point and end point, the shortest path to end point from the start point has to be found out using Astar (...
2
votes
2answers
178 views

Find combination of sets which sum up to a specified result

Example input : A) 1, 2 B) 2, 8 C) 7, 8 Required Result : 8, 10 The output from the program with this input should be A + C. Few notes : We can only combine 2 sets. There must ...
2
votes
2answers
155 views

C++ String Non-Member Operator Overloading

This is a practice for operator overloading, I am well aware that some of these don't make sense. I am seeking review only on the code/practices, not the purpose. ...
2
votes
2answers
188 views

Polymorphic implementation for == with CRTP

I'm trying to implement equality for all types that share same base. Consider std::vector<unique_ptr<Shape>> and that we want to check if a certain ...
2
votes
1answer
105 views

Operator overloading for Boost interval (vectors)

I am a complete newbie to C++ and programming in general. I need to write something for scientific purposes and as such, performance is crucial. I introduced two types, matrices and vectors with ...
2
votes
0answers
56 views

Python adding partialmethods to a class at compile time

I am writing a class for delayed operations on variables which are resolved at a later time. I am using pythons operator overloading but my class definition seems very boilerplatey. Is there a more ...
2
votes
0answers
243 views

Function overloading in Python

Motivation As an exercise, I wanted to try implementing function overloading in Python 3, i.e. to implement a way of defining multiple functions with the same name and then calling the appropriate ...
2
votes
0answers
440 views

Reference wrapper for functions overloadings and universal references

I have design a little class to allow to overload a function with universal references for a known type, but I'm not sure if that class will work as expected in any contexts. The indended purpose is ...
1
vote
3answers
3k views

Cartesian/polar coordinates program

Can I get my program checked for efficiency? As in, see if there are better ways of writing my code, for example, making more efficient use of memory and/or security options like where to use ...
1
vote
1answer
107 views

Operator Oveloading: “+” and “==” for two classes

I have one class Number (base class) and two child class Fraction and ...
1
vote
2answers
54 views

Generic function with same logic but different input structure

I have a data structure that looks like this: interface Node { originalWeight: number; currentWeight: number; } where both properties are floats between <...
1
vote
1answer
36 views

Getting a table from an Excel worksheet

I need to get a table from an Excel worksheet. Sometimes I know the worksheet that contains the table, other times I might know it's going to be in one of a handful of worksheets, and still other ...
1
vote
1answer
46 views

Overloading Java function (insert into binary tree)

I have a binary tree below and it seems to make sense to overload the insert() method. If insert() is called without a ...
1
vote
1answer
113 views

Get column of a matrix python with index operator

How can I refactor this code to generalize the argument parsing? I feel like this code can be better but I can't find a way. The usage syntax of the index operator is similar to the NumPy indexing ...
1
vote
1answer
452 views

Overload binary operator for vector [closed]

I want to be able to construct and fill a vector of bytes using a stream (binary shift) operators. So I overloaded operator << (...). Here is the code I want ...
1
vote
1answer
78 views

An iterator which behaves like an array with uniform values

I'm implementing an iterator which takes a single value and which you can advance for n times with a dereferencing yielding the single value - but before or after that range of n 'positions' you can't ...
1
vote
1answer
2k views

Extending string mapping

Basically I'm trying to generalise and extend the notion of mapping one string into another. There are two methods I often find myself using for this: Functions, and Dictionairies. So here are my 3 ...
1
vote
0answers
25 views

Overloading both for (non) constant access [closed]

I'd offer a couple of iterator accesses to the class member, both constant and non-constant. I came to the following solution, but it seems to me far more verbose than needed. I'd like somehow to ...
1
vote
0answers
70 views

Practice global operator new for my Fruit class and Apple derived class?

I want to practise global operator new/delete and new[]/delete[], how can I improve it? Here are one Fruit(Base) Class, and one Apple(Derived) Class. ...
0
votes
1answer
1k views

Polynomial class C++11

Initial stage of implementation of the polynomial class. Essentially I need to implement the basic mathematical operations. Right now I have implemented just addition. Was wondering if this is a good ...
0
votes
1answer
3k views

Add two fractions or two integers using template class and overloading

Question: Need to create three classes. Number Fraction Integer Requirements The first class should support “display”, “==”, and “+”. "Display" : This operation displays the Number itself in its ...
-1
votes
1answer
115 views

Using templates and function overloads to set DOM attributes [closed]

I'm making a library to build and manage a website. I want to control what gets to be inserted. For example I don't want to be able to insert ...
-2
votes
3answers
40 views

Refactorizing overloads with the same scope but different calls [closed]

Well I have 3 methods that are overloads, but in it's scope has the same scope except one method call. ...