include stdafx include iostream using namespace std template class cla

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include "stdafx.h"
#include "iostream"
using namespace std;
template <class T>
class z
{
public:
template<class T> void f1(T q)
{
cout << "First - " << q << endl;
};
template<class z> void f2(z w)
{
cout << "Second - " << w << endl;
};
template <class T> friend float f3(T);
};
template <class T> float f3(T e)
{
cout << "Third - " << e << endl;
return e*e;
}
int main()
{
z<int> hi;
hi.f1(1);
hi.f2(2);
cout << f3(3) << endl;
return 0;
}