fedegp wrote: |
---|
If i want ti define the functions with the output type "auto" |
You can't. A function returns either a variable of a specific type or nothing (void). In some circumstances (see
https://en.cppreference.com/w/cpp/language/auto ) the type can be deduced rather than stated explicitly, but it will nevertheless have some type.
If you want functions of different types then you can use template functions, to save having to write one of each type. If you want them to be elements of your class then the class will also have to be a template class.
See
http://www.cplusplus.com/doc/tutorial/functions2/
fedegp wrote: |
---|
variabile [sic] number of inputs |
Either:
- overload the function;
- use default arguments (default values will be used if that argument is not available);
- use variadic templates.
fedegp wrote: |
---|
Is it possibile [sic] to import the function from an external textfile? |
No idea what you mean. Your terminology, "import", might reflect a previous use of java or python, but it is alien to c++.
You can define the function in a separate .cpp file and link it if you wish. Your code that uses it will need an appropriate included header (.h) file to know the function prototype.
You don't need to use lambda functions as I did in my example; you could just put the names of pre-defined functions there. These functions may be in the same or other .cpp files, but their declarations must be known at the point of use, either by defining them above in the same file, or declaring a function prototype (which could be included in a .h file).
Your requirements are extremely vague. Please be very specific about what exactly you are trying to do, or we may give you completely inappropriate - or non-committal - advice. That may include you giving a specific example, or a precise statement of any assignment.