Specify the type parameter for generic function : Generic Function « Generics « Visual C++ .NET






Specify the type parameter for generic function

 
#include "stdafx.h"
using namespace System;

generic < typename T>
void GenericFunction(T t)
{
   Console::WriteLine(t);
}

int main()
{
   int i;

   GenericFunction<int>( 200 );


   GenericFunction( 400 );
}

   
  








Related examples in the same category

1.Generic function demo
2.Generic function allows the type parameter to be deduced
3.Generic function and generic array
4.generic multiple constraints
5.generic return value