Declaring function template that takes multiple argument types

: Following code shows how to achieve this.

#include <iostream.h>

template <class T, class U>

void fun ( T a, U b )

{

cout << a << ” ” << b << endl ;

}

void main( )

{

fun ( 12, 45.5 ) ;

fun ( 12.5, ‘A’ ) ;

}

Subscribe / Share

It's very calm over here, why not leave a comment?

Leave a Reply




Categories

Powered by Yahoo! Answers