Question about templates and function overloading

I have a function that I am passing a character to, however I want the function to return a an Integer. Should I do this through a template? Or if I overload the function would that work?
Last edited on
Simply write a function which accepts a char and returns an Integer Integer f(char) { ... }
Ok, I was under the impression that a function could only accept and return one data type
Ok, I was under the impression that a function could only accept and return one data type
Overloading applies when there are multiple functions with the same name, accepting different data types.
See: https://en.wikipedia.org/wiki/Function_overloading

Function templates are instructions to the compiler, describing how to write overloaded functions for you.
Last edited on
Topic archived. No new replies allowed.