Multiple Parameters and Return Values from Generic Functions
This video tutorial explains how to pass multiple parameters to a generic or template function and also how to return values from a generic function.
You are gonna learn how to define a generic or template function which is gonna take multiple parameters, how to return values from a generic function using return keyword in detail with example.
source code for this tutorial
#includeusing namespace std; template void display(T , T ); template T maxi(T x, T y); int main() { cout << maxi(20,30)< display(20,30); display("anil","anjali"); display(12.36,56.78); } templatevoid display(T x, T y){ cout << x << " and " << y << endl; } template T maxi(T x, T y){ return (x >= y) ? x : y; }