Template error when declaring function body outside the class body New comment Paolo Besana 2025.01.21 16:10 Hello everyone. Compiling this code I am getting the following error: "function 'Test::test' already defined and has different return type" template<typename any> struct Optional { any value; }; class Test { public: template<typename any> Optional<any> test(); }; template<typename any> Optional<any> Test::test() { return Optional<any>(); }But, if I write the function body inside the class I get no error: template<typename any> struct Optional { any value; }; class Test { public: template<typename any> Optional<any> test() { return Optional<any>(); } };Could someone help me to understand how to solve this problem? (I don't want to mark the whole class as template) Features of the mql5 language, subtleties and tricks where to add the protection code in the indicator, when I put it at start, the following error message appears: oninit' - function already defined and has body Storing number of opened trades in static variable like dictionary New comment
Hello everyone.
Compiling this code I am getting the following error: "function 'Test::test' already defined and has different return type"