You can do function overloading.
But what you want can easily be achieved in other ways, Type casting:
int getData(int index) { return 5; } ... string str = (string)getData(index); int i = (int)getData(index); double d = (double)getData(index);

- www.mql5.com
You can do function overloading.
But what you want can easily be achieved in other ways, Type casting:
You can do function overloading.
But what you want can easily be achieved in other ways, Type casting:
Functions/methods with the exact name and parameter types cannot exit into the same context.
I am thinking of using namespaces to isolate the contexts:
namespace ns_str { string getData(int index) { return "string"; } }; namespace ns_int { int getData(int index) { return 5; } }; namespace ns_dbl { double getData(int index) { return 5.0; } }; namespace ns_bool { bool getData(int index) { return false; } }; void OnStart() { Print( ns_str::getData(0) ); Print( ns_int::getData(0) ); Print( ns_dbl::getData(0) ); Print( ns_bool::getData(0) ); }
Functions/methods with the exact name and parameter types cannot exit into the same context.
I am thinking of using namespaces to isolate the contexts:
Not really as you see for using template functions like this you have to add it in input. Which is not ok for my thing.
You have to find an alternative because there is no way to determine the receiving type by the sending type.
And for a satisfiable alternative, you need to supply more info to the use case, something more than my thing.
You have to find an alternative because there is no way to determine the receiving type by the sending type.
And for a satisfiable alternative, you need to supply more info to the use case, something more than my thing.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
is there in any way possible to create something that could make this possible?
to have a function or method? a structure, class, some data type or anything that could solve this problem?
Thank You in advance 🙏🙏🙏