language: C++ 4.7.2 (gcc-4.7.2)
date: 1015 days 14 hours ago
link:
visibility: public
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
#include<iostream>
template< typename T >
class T1 {
public:
    T i;
    void display()
    {
       std::cout<<i<<"\n"<<j<<"\n"<<k; 
 }
protected:
    T j;
private:
    T k;
    friend void Test( T1 &obj);
};
 
template<typename T>
void Test(T1<T> &obj)
{
    T a=T();
 
    obj.i=a;
    obj.j=a;
    obj.k=a;
}
 
 
int main()
{
   T1<int>a;
   Test(a);
   a.display();
}
prog.cpp:14: warning: friend declaration ‘void Test(T1<T>&)’ declares a non-template function
prog.cpp:14: note: (if this is not what you intended, make sure the function template has already been declared and add <> after the function name here) 
/home/SUNPHd/cch2QnuO.o: In function `main':
prog.cpp:(.text+0x55): undefined reference to `Test(T1<int>&)'
collect2: ld returned 1 exit status