Total members 11895 |It is currently Sat Dec 21, 2024 3:56 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





In this code we define a new C++ template type.
Code:
#include <iostream>
using namespace std;

template <class type1, class type2>
void myFunction(type1 x, type2 y)
{
  cout << x << ' ' << y << '\n';
}

int main()
{
  myFunction(10, "hi");

  myFunction(0.23, 10L);

  return 0;
}
 


the output is :
10 Hi
0.23 10L



_________________
Please recommend my post if you found it helpful


Author:
Beginner
User avatar Posts: 95
Have thanks: 2 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Define template in C++
 Template to start HTML5     -  
 How to add Google plus button to smarty template (.tpl)     -  
 Define statement     -  
 Define new namespaces in C++     -  
 how to Define abstract class in php     -  
 Define your own exception class     -  
 define a Class with a Method     -  
 Define enum in java     -  
 define final class     -  
 define UUID in your XSD schema     -  



Topic Tags

C++ OOP






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com