piątek, 10 stycznia 2014
C++ function templates 1
#include <iostream>
using namespace std;
template <class A>
A dodaj(A a,A b)
{
return a+b;
}
int main()
{
cout << "function templates!" << endl;
cout<<"int="<<dodaj(1,2)<<endl;
cout<<"float="<<dodaj(1.01,2.11)<<endl;
cout<<"char="<<dodaj(' ','b')<<endl;
return 0;
}
Brak komentarzy:
Prześlij komentarz
Nowszy post
Starszy post
Strona główna
Subskrybuj:
Komentarze do posta (Atom)
Brak komentarzy:
Prześlij komentarz